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

Method writeAllChunk

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

Source from the content-addressed store, hash-verified

305 }
306
307 private writeAllChunk(buffer: Uint8Array): Effect.Effect<void, PlatformError.PlatformError> {
308 return Effect.flatMap(this.writeChunk("writeAll", buffer), (bytesWritten) => {
309 if (bytesWritten === BigInt(0)) {
310 return Effect.fail(PlatformError.systemError({
311 module: "FileSystem",
312 method: "writeAll",
313 _tag: "WriteZero",
314 description: "write returned 0 bytes written"
315 }))
316 }
317 return bytesWritten < buffer.length
318 ? this.writeAllChunk(buffer.subarray(Number(bytesWritten)))
319 : Effect.void
320 })
321 }
322
323 writeAll(buffer: Uint8Array) {
324 return buffer.length === 0 ? Effect.void : this.writeAllChunk(buffer)

Callers 1

writeAllMethod · 0.95

Calls 4

writeChunkMethod · 0.95
BigIntInterface · 0.50
NumberInterface · 0.50
failMethod · 0.45

Tested by

no test coverage detected