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

Method atCursor

packages/platform/node-shared/src/NodeFileSystem.ts:365–385  ·  view source on GitHub ↗
(
      f: (position: bigint | null) => Effect.Effect<number, Error.PlatformError>
    )

Source from the content-addressed store, hash-verified

363 // rejects positioned I/O with ESPIPE (pipes, sockets, terminals), retry
364 // sequentially and stay sequential for this handle.
365 private atCursor(
366 f: (position: bigint | null) => Effect.Effect<number, Error.PlatformError>
367 ): Effect.Effect<number, Error.PlatformError> {
368 return Effect.suspend(() => {
369 if (this.sequential) {
370 return f(null)
371 }
372 const position = this.position
373 return Effect.catchIf(
374 Effect.map(f(position), (bytes) => {
375 this.position = position + BigInt(bytes)
376 return bytes
377 }),
378 isEspipe,
379 () => {
380 this.sequential = true
381 return f(null)
382 }
383 )
384 })
385 }
386
387 private writeOnce(method: string, write: typeof nodeWrite, buffer: Uint8Array) {
388 return this.append ?

Callers 3

writeOnceMethod · 0.95
readMethod · 0.95
readAllocMethod · 0.95

Calls 3

fFunction · 0.50
BigIntInterface · 0.50
mapMethod · 0.45

Tested by

no test coverage detected