Skip to content

Interface: UploadedFile

Defined in: packages/apollo/src/upload.ts:52

Represents an uploaded file in a GraphQL multipart request. Provides access to file metadata and streaming capabilities.

Example

typescript
const resolve = async (_, { file }: { file: Promise<UploadedFile> }) => {
  const upload = await file;
  const stream = upload.stream;
  // Process stream...
};

Methods

arrayBuffer()

ts
arrayBuffer(): Promise<ArrayBuffer>;

Defined in: packages/apollo/src/upload.ts:66

Reads the entire file into an ArrayBuffer.

Returns

Promise<ArrayBuffer>


blob()

ts
blob(): Promise<Blob>;

Defined in: packages/apollo/src/upload.ts:64

Returns the file as a Blob.

Returns

Promise<Blob>


text()

ts
text(): Promise<string>;

Defined in: packages/apollo/src/upload.ts:68

Reads the entire file as UTF-8 text.

Returns

Promise<string>

Properties

PropertyModifierTypeDescriptionDefined in
fieldNamereadonlystringThe form field name for this file upload.packages/apollo/src/upload.ts:54
filenamereadonlystringThe original filename provided by the client.packages/apollo/src/upload.ts:56
mimetypereadonlystringThe MIME type of the file (e.g., 'image/jpeg', 'application/pdf').packages/apollo/src/upload.ts:58
sizereadonlynumberThe file size in bytes.packages/apollo/src/upload.ts:60
streamreadonlyReadableStream<Uint8Array<ArrayBufferLike>>A readable stream of the file contents. Native Web Streams API.packages/apollo/src/upload.ts:62

Released under the MIT License.