MCPcopy
hub / github.com/Effect-TS/effect / onFile

Function onFile

packages/platform/src/Multipart.ts:312–334  ·  view source on GitHub ↗
(info)

Source from the content-addressed store, hash-verified

310 partsBuffer.push(new FieldImpl(info.name, info.contentType, MP.decodeField(info, value)))
311 },
312 onFile(info) {
313 let chunks: Array<Uint8Array> = []
314 let finished = false
315 const take: Channel.Channel<Chunk.Chunk<Uint8Array>> = Channel.suspend(() => {
316 if (chunks.length === 0) {
317 return finished ? Channel.void : Channel.zipRight(pump, take)
318 }
319 const chunk = Chunk.unsafeFromArray(chunks)
320 chunks = []
321 return finished ? Channel.write(chunk) : Channel.zipRight(
322 Channel.write(chunk),
323 Channel.zipRight(pump, take)
324 )
325 })
326 partsBuffer.push(new FileImpl(info, take))
327 return function(chunk) {
328 if (chunk === null) {
329 finished = true
330 } else {
331 chunks.push(chunk)
332 }
333 }
334 },
335 onError(error_) {
336 exit = Option.some(Exit.fail(convertError(error_)))
337 },

Callers

nothing calls this directly

Calls 1

writeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…