MCPcopy Index your code
hub / github.com/simstudioai/sim / readFileToBufferWithLimit

Function readFileToBufferWithLimit

apps/sim/lib/core/utils/stream-limits.ts:310–318  ·  view source on GitHub ↗
(
  file: File,
  options: { maxBytes: number; label: string }
)

Source from the content-addressed store, hash-verified

308}
309
310export async function readFileToBufferWithLimit(
311 file: File,
312 options: { maxBytes: number; label: string }
313): Promise<Buffer> {
314 assertKnownSizeWithinLimit(file.size, options.maxBytes, options.label)
315 const buffer = Buffer.from(await file.arrayBuffer())
316 assertKnownSizeWithinLimit(buffer.byteLength, options.maxBytes, options.label)
317 return buffer
318}
319
320export async function consumeOrCancelBody(
321 response: { body?: ReadableStream<Uint8Array> | null },

Callers 3

route.tsFile · 0.90
route.tsFile · 0.90

Calls 1

Tested by

no test coverage detected