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

Method readAlloc

packages/platform/deno/src/DenoFileSystem.ts:250–261  ·  view source on GitHub ↗
(size: FileSystem.SizeInput)

Source from the content-addressed store, hash-verified

248 }
249
250 readAlloc(size: FileSystem.SizeInput) {
251 const sizeNumber = Number(size)
252 return Effect.suspend(() => {
253 const buffer = new Uint8Array(sizeNumber)
254 return Effect.map(this.readChunk("readAlloc", buffer), (bytesRead) => {
255 if (bytesRead === BigInt(0)) {
256 return Option.none()
257 }
258 return Option.some(bytesRead === BigInt(sizeNumber) ? buffer : buffer.subarray(0, Number(bytesRead)))
259 })
260 })
261 }
262
263 truncate(length?: FileSystem.SizeInput) {
264 const size = FileSystem.Size(length ?? 0)

Callers 2

testLayerFunction · 0.45
makeFunction · 0.45

Calls 5

readChunkMethod · 0.95
someMethod · 0.80
NumberInterface · 0.50
BigIntInterface · 0.50
mapMethod · 0.45

Tested by

no test coverage detected