|
6 | 6 |
|
7 | 7 | - **Universal JavaScript** - One library that works everywhere: Node.js, Bun, Deno, Cloudflare Workers, and browsers
|
8 | 8 | - **Blazing Fast** - Consistently outperforms popular alternatives like busboy in benchmarks
|
9 |
| -- **Zero Dependencies** - Lightweight and secure with no external dependencies for core functionality |
| 9 | +- **Zero Dependencies** - Lightweight and secure with no external dependencies |
10 | 10 | - **Memory Efficient** - Streaming architecture that `yield`s files as they are found in the stream
|
11 | 11 | - **Type Safe** - Written in TypeScript with comprehensive type definitions
|
12 | 12 | - **Standards Based** - Built on the web standard [Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) for maximum compatibility
|
|
16 | 16 |
|
17 | 17 | - Parse file uploads (`multipart/form-data`) with automatic field and file detection
|
18 | 18 | - Support for all `multipart/*` content types (mixed, alternative, related, etc.)
|
19 |
| -- Convenient `MultipartPart` API with `arrayBuffer`, `bytes`, `text`, and metadata access |
| 19 | +- Convenient `MultipartPart` API with `arrayBuffer`, `bytes`, `text`, `size`, and metadata access |
20 | 20 | - Built-in file size limiting to prevent abuse
|
21 | 21 | - First-class Node.js support with native `http.IncomingMessage` compatibility
|
22 | 22 | - [Examples for every major runtime](https://github.com/mjackson/remix-the-web/tree/main/packages/multipart-parser/examples)
|
@@ -46,7 +46,7 @@ async function handleRequest(request: Request): void {
|
46 | 46 | try {
|
47 | 47 | for await (let part of parseMultipartRequest(request)) {
|
48 | 48 | if (part.isFile) {
|
49 |
| - // Access file data in multiple formats - all sync! |
| 49 | + // Access file data in multiple formats |
50 | 50 | let buffer = part.arrayBuffer; // ArrayBuffer
|
51 | 51 | console.log(`File received: ${part.filename} (${buffer.byteLength} bytes)`);
|
52 | 52 | console.log(`Content type: ${part.mediaType}`);
|
@@ -101,7 +101,7 @@ async function handleRequest(request: Request): Promise<Response> {
|
101 | 101 | }
|
102 | 102 | ```
|
103 | 103 |
|
104 |
| -## Node.js Support |
| 104 | +## Node.js Bindings |
105 | 105 |
|
106 | 106 | The main module (`import from "@mjackson/multipart-parser"`) assumes you're working with [the fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) (`Request`, `ReadableStream`, etc). Support for these interfaces was added to Node.js by the [undici](https://github.com/nodejs/undici) project in [version 16.5.0](https://nodejs.org/en/blog/release/v16.5.0).
|
107 | 107 |
|
|
0 commit comments