Upload a file. Stores a new file or replaces an existing file.
file (required)FileThe file to upload.
bucketIdStringThe bucket to be used. If no bucketId is specified the default bucket is used.
idStringDatabase ID of the file to override. If no id is specified, the server generates a unique ID for the file.
const { fileMetadata, error } = await nhost.storage.upload({ file });

Get the public URL of a file. To access the file via public URL, the file must have the select permission for the public role.
const url = nhost.storage.getUrl({ fileId });

Get a presigned URL for a file. To generate a presigned URL for the file, a user has to be logged in and have select permission to the file.
const { presignedUrl, error } = await nhost.storage.getPresignedUrl({ fileId });

Delete a file.
const { error } = await nhost.storage.delete({ fileId });