Skip to main content

createReadAttachmentTool

@forge/monorepo


@forge/monorepo / backend/src / createReadAttachmentTool

Function: createReadAttachmentTool()

createReadAttachmentTool(deps): Tool

Defined in: backend/src/files/read-tool.ts:78

Read a bounded window of an attachment.

The window is taken by consuming the stream and discarding what precedes the offset, rather than by assembling the whole file and slicing it: a 100 MB file must not be held in memory to read its first kilobyte, which is the mistake that makes a "bounded" read unbounded in the only dimension that matters.

Parameters

deps

files

{ limits: UploadLimits; deleteConversationFiles: Promise<{ scheduled: number; }>; get: Promise<FileMetadata>; listForConversation: Promise<Page<FileMetadata>>; read: Promise<AsyncIterable<Uint8Array<ArrayBufferLike>, any, any>>; signedReadUrl: Promise<string | null>; sweepDeletions: Promise<{ deleted: number; failed: number; }>; upload: Promise<FileMetadata>; }

files.limits

UploadLimits

files.deleteConversationFiles

files.get

files.listForConversation

files.read

files.signedReadUrl

files.sweepDeletions

files.upload

Returns

Tool