Skip to content

remix/multipart-parser/future · Function

View Source

parseMultipartRequest

Summary

Parse a multipart Request and yield each part as a MultipartPart as soon as its headers arrive. Part content is streamed from the request body as you read it, so large uploads are never buffered in memory.

Read each part's content before continuing to the next part. When you continue, the parser waits for a read you started to finish and discards any content you didn't read.

Signature

function parseMultipartRequest(
  request: Request,
  options: MultipartParserOptions,
): AsyncGenerator<MultipartPart, void, unknown>

Parameters

request

The Request object containing multipart data

options

Optional parser options, such as maxHeaderSize, maxFileSize, maxParts, and maxTotalSize

Returns

An async generator yielding MultipartPart objects