Skip to content

NodeMultipart.ts

Node.js multipart parsing for HTTP multipart/form-data request bodies.

NodeMultipart adapts a Node Readable plus incoming HTTP headers into Effect’s shared multipart model. It can expose form parts as a stream or collect a complete persisted form by writing file uploads to scoped temporary files through the current FileSystem and Path services. fileToReadable returns the underlying Node readable stream for file parts produced by this parser.

Since v4.0.0



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

Signature

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

Source

Since v4.0.0

Parses multipart data from a Node readable request body and headers into a stream of Multipart.Part values, converting parser failures to MultipartError.

Signature

declare const stream: (
source: Readable,
headers: IncomingHttpHeaders
) => Stream.Stream<Multipart.Part, Multipart.MultipartError>

Source

Since v4.0.0

Returns the underlying Node readable stream for a multipart file produced by the Node multipart parser.

Signature

declare const fileToReadable: (file: Multipart.File) => Readable

Source

Since v4.0.0