> 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
