Hyperlinkv0.8.0-beta.28

NodeMultipart

(source: Readable, headers: IncomingHttpHeaders): Effect.Effect<
  Multipart.Persisted,
  Multipart.MultipartError,
  Scope.Scope | FileSystem.FileSystem | Path.Path
>

Parses multipart data from a Node readable request body and persists file parts using the current FileSystem, Path, and Scope services.

constructors
export const persisted = (
  source: Readable,
  headers: IncomingHttpHeaders
): Effect.Effect<
  Multipart.Persisted,
  Multipart.MultipartError,
  Scope.Scope | FileSystem.FileSystem | Path.Path
> =>
  Multipart.toPersisted(stream(source, headers), (path, file) =>
    Effect.tryPromise({
      try: (signal) => NodeStreamP.pipeline((file as FileImpl).file, NFS.createWriteStream(path), { signal }),
      catch: (cause) => Multipart.MultipartError.fromReason("InternalError", cause)
    }))