Create Image Metadata
Parameter | Purpose | Example |
---|---|---|
access | Access level for the stored image | public , private |
value | Source file to create image from | $input.file , $file.data |
filename | Name for the stored image file | "profile.jpg" , "avatar.png" |
as | Alias to reference the image metadata | image_metadata , uploaded_image |
Example
Example
- Creates metadata about the stored image
Private Access Example
Private Access Example
- Stores the image as private (requires signed URL to access)
Create Video Metadata
Parameter | Purpose | Example |
---|---|---|
access | Access level for the stored video | public , private |
value | Source file to create video from | $input.video , $file.data |
filename | Name for the stored video file | "video.mp4" , "recording.mov" |
as | Alias to reference the video metadata | x1 , video_data |
Example
Example
- Creates metadata for a video file
Create Audio Metadata
Parameter | Purpose | Example |
---|---|---|
access | Access level for the stored audio | public , private |
value | Source file to create audio from | $input.file , $audio.data |
filename | Name for the stored audio file | "recording.mp3" , "audio.wav" |
as | Alias to reference the audio metadata | x2 , audio_data |
Example
Example
- Creates metadata for audio file
Create Attachment Metadata
Parameter | Purpose | Example |
---|---|---|
access | Access level for the stored attachment | public , private |
value | Source file to create attachment from | $input.file , $document.data |
filename | Name for the stored attachment | "document.pdf" , "spreadsheet.xlsx" |
as | Alias to reference the attachment metadata | x3 , file_data |
Example
Example
- Creates metadata for the attachment
Create File Resource
Parameter | Purpose | Example |
---|---|---|
filename | Name of the file to create | "document.txt" , "data.json" |
filedata | Content of the file | "Hello World" , $encoded_data |
Example
Example
- Creates a file resource from provided data
Get File Resource Data
Parameter | Purpose | Example |
---|---|---|
value | File resource to read | $input.file , $stored_file.id |
as | Alias to reference the file contents | file2 , file_contents |
Example
Example
- Reads contents of a stored file resource
Delete File
Parameter | Purpose | Example |
---|---|---|
pathname | Path to the file to delete | "/path/to/file.ext" , $file.path |
Example
Example
- Deletes a file from the specified path
- Requires full path to the file
- Permanently removes the file
- Use with caution as deletion cannot be undone
Sign Private File URL
Parameter | Purpose | Example |
---|---|---|
pathname | Path to the private file | "/path/to/privatefile.ext" , $file.path |
ttl | Time-to-live in seconds for the signed URL | 30 , 3600 , 86400 |
as | Alias to reference the signed URL | x4 , signed_url |
Example
Example
- Generates a temporary signed URL for accessing private files
Notes on Returned Metadata
Allstorage.create_*
functions return a metadata object with fields such as:
id
: Unique identifier for the file resourcename
: File namesize
: File size in bytesmime
: MIME typepath
: Storage pathurl
: Public URL (if access is public)created_at
: Timestamp
Error Handling Example
If you attempt to read or delete a file that does not exist, Xano will throw an error. You can handle this withtry_catch
: