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

x/openai/uploads.ts>toFile

Deno build of the official Typescript library for the OpenAI API.
Extremely Popular
Go to Latest
function toFile
import { toFile } from "https://deno.land/x/openai@v4.61.1/uploads.ts";

Helper for creating a File to pass to an SDK upload method from a variety of different data formats

Parameters

value: ToFileInput | PromiseLike<ToFileInput>

the raw content of the file. Can be an Uploadable, BlobLikePart, or AsyncIterable of BlobLikeParts

optional
name: string | null | undefined

the name of the file. If omitted, toFile will try to determine a file name from bits if possible

optional
options: FilePropertyBag | undefined

additional properties

Returns

Promise<FileLike>

a File with the given properties