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

Function fileFromInfo

packages/effect/src/unstable/http/HttpBody.ts:542–560  ·  view source on GitHub ↗
(
  path: string,
  info: FileSystem.File.Info,
  options?: {
    readonly bytesToRead?: FileSystem.SizeInput | undefined
    readonly chunkSize?: FileSystem.SizeInput | undefined
    readonly offset?: FileSystem.SizeInput | undefined
    readonly contentType?: string | undefined
  }
)

Source from the content-addressed store, hash-verified

540 * @since 4.0.0
541 */
542export const fileFromInfo = (
543 path: string,
544 info: FileSystem.File.Info,
545 options?: {
546 readonly bytesToRead?: FileSystem.SizeInput | undefined
547 readonly chunkSize?: FileSystem.SizeInput | undefined
548 readonly offset?: FileSystem.SizeInput | undefined
549 readonly contentType?: string | undefined
550 }
551): Effect.Effect<Stream, PlatformError.PlatformError, FileSystem.FileSystem> =>
552 Effect.map(
553 FileSystem.FileSystem,
554 (fs) =>
555 stream(
556 fs.stream(path, options),
557 options?.contentType,
558 fileContentLength(info.size, options)
559 )
560 )

Callers

nothing calls this directly

Calls 4

fileContentLengthFunction · 0.85
streamFunction · 0.70
streamMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected