MCPcopy Create free account
hub / github.com/Effect-TS/effect / startDeflates

Function startDeflates

packages/effect/src/encoding/Zip.ts:554–568  ·  view source on GitHub ↗
(from: number)

Source from the content-addressed store, hash-verified

552 let deflates: Array<Deflating | undefined> = []
553
554 const startDeflates = (from: number): void => {
555 for (let i = from; i < Math.min(entries.length, from + DEFLATE_AHEAD); i++) {
556 if (deflates[i] !== undefined) continue
557 const { content, header } = entries[i]
558 if (header.type !== "File" || header.method !== "Deflate" || content === undefined) continue
559 if (i > from && content.length > DEFLATE_AHEAD_SIZE) continue
560 const deflating: Deflating = { promise: deflateBytes(content), data: undefined }
561 // Failures surface when the entry is written; deflates left behind by
562 // a failed encode finish on their own
563 deflating.promise.then((data) => {
564 deflating.data = data
565 }, () => {})
566 deflates[i] = deflating
567 }
568 }
569
570 const write = (f: () => void): Effect.Effect<void, ZipError> => {
571 try {

Callers 1

encodeFunction · 0.85

Calls 1

deflateBytesFunction · 0.85

Tested by

no test coverage detected