Save a file
Import the function at the top of your file
import { saveFile } from "swizzle-js";Upload a file to storage with saveFile(fileName, fileData, isPrivate?, allowedUsers?)
fileNameis the filename (searchable later, does not have to be unique). Include the file extension.fileDatais the data you'd like to upload.isPrivateif this is set to true, the URL will not be accessible unless signed by the getFile function or the user is in allowedUsers.allowedUsersis an array of userIds. If these users pass their access token in the Authorization header or under the token parameter in the query string, they will be allowed to access the file automatically.
Returns the hosted file URL (unsigned)
const url = await saveFile(fileName, fileData, isPrivate, allowedUsers)Last updated