"CachedFile" (Interpreter Type)
A file to be copied in a local directory.
Details
- "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.
- "CachedFile" treats File ["file"] and URL ["url"] as "file" and "url", respectively.
Allowed Forms
-
File ["path"] a path to a local fileURL ["url"] a URLCloudObject ["url"] a cloud object
Restriction Specifications
-
Restricted ["CachedFile" ,format] a file of a given formatRestricted ["CachedFile" ,format,max] a file of a given format and size smaller than max bytesRestricted ["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"]).
Interpretation
- "CachedFile" yields File ["newpath"], where "newpath" is where the file has been copied to.
Examples
Basic Examples (1)
Cache files:
Restrict to a file format:
Restrict to all image files:
Restrict to a given size:
"CachedFile" also works with a CloudObject :
"CachedFile" also works with a URL object:
See Also
Interpreter Restricted Failure CloudObject File URL
Interpreter Types: UploadedFile FileName ImportFormatString ExportFormatString MIMETypeString