> For the complete documentation index, see [llms.txt](https://docs.jetadmin.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jetadmin.io/api-reference/javascript-sdk/storage.md).

# File storage

Use `jet.storage(resourceName, storageName)` to work with a configured storage resource. Paths and permissions are determined by that resource.

### Upload a browser file

Pass the `File` selected by your application's file input:

```typescript
import { Jet } from '@jet-admin/jet-sdk';

async function uploadDocument(jet: Jet, file: File) {
  const response = await jet.storage('YOUR_RESOURCE', 'YOUR_STORAGE').uploadFile({
    path: 'documents',
    fileName: file.name,
    file,
  });
  return response.result; // { path, url }
}
```

`uploadFile({ file, path?, fileName? })` accepts a `Blob` and uses multipart `FormData`. A browser `File` supplies its own multipart filename; `fileName` is also sent as a separate `file_name` field. The implementation references the global `File` constructor even for a Blob.

The resolved response has `result.path`, `result.url`, and `state.uploadProgress` / `state.downloadProgress`. These state values come from the completed server response. This method does not expose live progress callbacks.

### Browse, create folders, and get URLs

```typescript
import { Jet } from '@jet-admin/jet-sdk';

async function listDocuments(jet: Jet) {
  const response = await jet.storage('YOUR_RESOURCE', 'YOUR_STORAGE')
    .listObjects({ path: 'documents' });
  return response.objects;
}

async function createFolder(jet: Jet, path: string) {
  return jet.storage('YOUR_RESOURCE', 'YOUR_STORAGE').createFolder({ path });
}

async function getDownloadUrl(jet: Jet, path: string) {
  const response = await jet.storage('YOUR_RESOURCE', 'YOUR_STORAGE').getObjectUrl({ path });
  return response.url;
}

async function deleteFile(jet: Jet, path: string) {
  return jet.storage('YOUR_RESOURCE', 'YOUR_STORAGE').deleteObject({ path });
}
```

| Method         | Options                              | Resolved response                          |
| -------------- | ------------------------------------ | ------------------------------------------ |
| `listObjects`  | Optional `{ path?: string }`         | `{ objects, storageSize?, storageLimit? }` |
| `createFolder` | `{ path: string }`                   | `{ result: boolean }`                      |
| `getObjectUrl` | `{ path: string, expires?: number }` | `{ url: string }`                          |
| `deleteObject` | `{ path: string }`                   | `{ result: boolean }`                      |

Objects have `path`, `url`, `type` (`file` or `folder`), optional `size`, and dates converted to `Date` when returned by the listing API. Inspect `result` for create/delete operations.

`expires` is forwarded unchanged. Its unit, limits, and default are not specified in this SDK; use your storage API's contract before setting it. Listing has no SDK pagination argument. Folder deletion semantics are resource-specific.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.jetadmin.io/api-reference/javascript-sdk/storage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
