Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ await client.files.create({
});
```

To retrieve uploaded file contents, use `files.content()` and consume the returned
web standard `Response`:

```ts
const response = await client.files.content('file-abc123');
const fileContents = await response.arrayBuffer();
```

For text files, you can use `await response.text()` instead.

## Webhook Verification

Verifying webhook signatures is _optional but encouraged_.
Expand Down
2 changes: 1 addition & 1 deletion src/resources/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class Files extends APIResource {

export type FileObjectsPage = CursorPage<FileObject>;

export type FileContent = string;
export type FileContent = Response;

export interface FileDeleted {
id: string;
Expand Down