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

Method writeAllChunk

packages/platform/deno/src/DenoFileSystem.ts:343–357  ·  view source on GitHub ↗
(buffer: Uint8Array)

Source from the content-addressed store, hash-verified

341 }
342
343 private writeAllChunk(buffer: Uint8Array): Effect.Effect<void, PlatformError.PlatformError> {
344 return Effect.flatMap(this.writeChunk("writeAll", buffer), (bytesWritten) => {
345 if (bytesWritten === 0) {
346 return Effect.fail(PlatformError.systemError({
347 module: "FileSystem",
348 method: "writeAll",
349 _tag: "WriteZero",
350 description: "write returned 0 bytes written"
351 }))
352 }
353 return bytesWritten < buffer.length
354 ? this.writeAllChunk(buffer.subarray(bytesWritten))
355 : Effect.void
356 })
357 }
358
359 writeAll(buffer: Uint8Array) {
360 return buffer.length === 0 ? Effect.void : this.writeAllChunk(buffer)

Callers 1

writeAllMethod · 0.95

Calls 2

writeChunkMethod · 0.95
failMethod · 0.65

Tested by

no test coverage detected