Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/openai/resources/mod.ts>Files

Deno build of the official Typescript library for the OpenAI API.
Extremely Popular
Go to Latest
namespace Files
import { Files } from "https://deno.land/x/openai@v4.26.0/resources/mod.ts";
class Files
extends APIResource
import { Files } from "https://deno.land/x/openai@v4.26.0/resources/mod.ts";

Methods

content(fileId: string, options?: Core.RequestOptions): Core.APIPromise<Response>

Returns the contents of the specified file.

create(body: FileCreateParams, options?: Core.RequestOptions): Core.APIPromise<FileObject>

Upload a file that can be used across various endpoints. The size of all the files uploaded by one organization can be up to 100 GB.

The size of individual files can be a maximum of 512 MB or 2 million tokens for Assistants. See the Assistants Tools guide to learn more about the types of files supported. The Fine-tuning API only supports .jsonl files.

Please contact us if you need to increase these storage limits.

del(fileId: string, options?: Core.RequestOptions): Core.APIPromise<FileDeleted>

Delete a file.

list(query?: FileListParams, options?: Core.RequestOptions): Core.PagePromise<FileObjectsPage, FileObject>

Returns a list of files that belong to the user's organization.

list(options?: Core.RequestOptions): Core.PagePromise<FileObjectsPage, FileObject>
retrieve(fileId: string, options?: Core.RequestOptions): Core.APIPromise<FileObject>

Returns information about a specific file.

deprecated
retrieveContent(fileId: string, options?: Core.RequestOptions): Core.APIPromise<string>

Returns the contents of the specified file.

waitForProcessing(id: string, unnamed 1?: { pollInterval?: number; maxWait?: number; }): Promise<FileObject>

Waits for the given file to be processed, default timeout is 30 mins.