Files

Upload, download, link to and organize files in your app's storage with @authoric/js.

authoric.storage reaches your app's file storage as the signed-in user.

const storages = await authoric.storage.list();
const storageUid = storages[0].uid;

// In a browser, `file` comes from an <input type="file">.
const { files } = await authoric.storage.upload(storageUid, file, {
  path: "/2026/q3", // missing folders are created
  onProgress: ({ loaded, total }) => setProgress(loaded / total),
});

upload takes a File or Blob, or an array of them. Files of 5 MB and up go straight to the storage provider, so their bytes never pass through the API; smaller files go through the API. A storage that takes no direct uploads always goes through the API. mode: "direct" or mode: "api" chooses for you.

const { url, kind, expiresAt } = await authoric.storage.url(fileUid, { expiresIn: 3600 });
imageElement.src = url;

const blob = await authoric.storage.download(fileUid); // the bytes, with the user's token

A link needs no token, so it works in an <img>, a link or an email. A public storage's links are permanent; a private storage's are signed and expire (15 minutes unless you say otherwise). Anyone holding a signed link can open the file until it expires, so hand it only to whoever asked.

Folders and changes

const listing = await authoric.storage.folder(storageUid, { path: "/2026/q3" });
// { folder, folders, files, counts, paging }

await authoric.storage.createFolder(storageUid, { path: "/2026/q4" });
await authoric.storage.update(fileUid, { name: "signed.pdf", metadata: { signed: true } });
await authoric.storage.remove(fileUid);

Each organization sees its own files. A file the app's owner shares with the user's organization is marked sharedByOwner: true and can be opened, not changed.

On this page