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

Function persisted

packages/platform/node/src/NodeMultipart.ts:62–74  ·  view source on GitHub ↗
(
  source: Readable,
  headers: IncomingHttpHeaders
)

Source from the content-addressed store, hash-verified

60 * @since 4.0.0
61 */
62export const persisted = (
63 source: Readable,
64 headers: IncomingHttpHeaders
65): Effect.Effect<
66 Multipart.Persisted,
67 Multipart.MultipartError,
68 Scope.Scope | FileSystem.FileSystem | Path.Path
69> =>
70 Multipart.toPersisted(stream(source, headers), (path, file) =>
71 Effect.tryPromise({
72 try: (signal) => NodeStreamP.pipeline((file as FileImpl).file, NFS.createWriteStream(path), { signal }),
73 catch: (cause) => Multipart.MultipartError.fromReason("InternalError", cause)
74 }))
75
76/**
77 * Returns the underlying Node readable stream for a multipart file produced by

Callers

nothing calls this directly

Calls 2

streamFunction · 0.70
fromReasonMethod · 0.45

Tested by

no test coverage detected