"CachedFile" (interpreter type)

A file to be copied in a local directory.

DetailsDetails

  • "CachedFile" can be used in Interpreter and related constructs, including deployed smart form fields.
  • Use of "CachedFile" does not require connectivity to the Wolfram Cloud.
  • Unlike most interpretation types "CachedFile" has a side effect: it creates a new file on disk.

Allowed FormsAllowed Forms

Restriction SpecificationsRestriction Specifications

  • Restricted["CachedFile", format]A file of a given format
    Restricted["CachedFile", format, max]A file of a given format and size smaller than max bytes
    Restricted["CachedFile", format, {min, max}]A file of a given format and size between min and max bytes
  • The bounds min and max can also be expressed as quantities in the appropriate unit (e.g. Quantity[1,"Megabytes"]).

InterpretationInterpretation

  • "CachedFile" yields File[newpath], where newpath is where the file has been copied to.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Cache files:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Restrict to a file format:

In[3]:=
Click for copyable input
Out[3]=

Restrict to all image files:

In[4]:=
Click for copyable input
Out[4]=

Restrict to a given size:

In[5]:=
Click for copyable input
Out[5]=

"CachedFile" also works on cloud objects:

Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=