Skip to main content
Module

x/appwrite/mod.ts>Storage

[READ-ONLY] Official Appwrite Deno SDK 🦕
Go to Latest
class Storage
extends Service
Re-export
import { Storage } from "https://deno.land/x/appwrite@0.3.0/mod.ts";

Methods

createFile<T extends unknown>(
file: File | Blob,
read?: string[],
write?: string[],
): Promise<T>

Create File

Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments.

deleteFile<T extends unknown>(fileId: string): Promise<T>

Delete File

Delete a file by its unique ID. Only users with write permissions have access to delete this resource.

getFile<T extends unknown>(fileId: string): Promise<T>

Get File

Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.

getFileDownload(fileId: string): Promise<Response>

Get File for Download

Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.

getFilePreview(
fileId: string,
width?: number,
height?: number,
gravity?: string,
quality?: number,
borderWidth?: number,
borderColor?: string,
borderRadius?: number,
opacity?: number,
rotation?: number,
background?: string,
output?: string,
): Promise<Response>

Get File Preview

Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image.

getFileView(fileId: string): Promise<Response>

Get File for View

Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.

listFiles<T extends unknown>(
search?: string,
limit?: number,
offset?: number,
orderType?: string,
): Promise<T>

List Files

Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's files. Learn more about different API modes.

updateFile<T extends unknown>(
fileId: string,
read: string[],
write: string[],
): Promise<T>

Update File

Update a file by its unique ID. Only users with write permissions have access to update this resource.