An open API service indexing awesome lists of open source software.

https://github.com/zebp/streaming-multipart

streaming-multipart
https://github.com/zebp/streaming-multipart

Last synced: about 2 months ago
JSON representation

streaming-multipart

Awesome Lists containing this project

README

        

streaming-multipart


A streaming multipart reader and writer for Web-compatible JavaScript runtimes with zero dependencies.



downloads


npm version


MIT license

```ts
import { MultipartReader } from "streaming-multipart";

const form = new FormData();
form.append("foo", "bar");
form.append(
"file",
new Blob(["hello world"], { type: "text/plain" }),
"file.txt",
);

const reader = new MultipartReader(
new Request("https://example.com", {
method: "POST",
body: form,
}),
);

for await (const part of reader) {
const body = await part.arrayBuffer();
console.log(part.name, part.fileName, part.headers, body);
}
```

## Features

- Streaming support
- Supports Node.js, Deno, Cloudflare Workers, and other Web-compatible
JavaScript runtimes
- Zero dependencies

## Requirements

- A Web-compatible JavaScript runtime (Node.js, Deno, Bun, Cloudflare Workers,
etc.)

## Installation

Via npm:

```sh
npm install streaming-multipart
```

Via yarn:

```sh
yarn add streaming-multipart
```

Via pnpm:

```sh
pnpm add streaming-multipart
```

Via deno:

```ts
import { MultipartReader } from "https://deno.land/x/streaming_multipart/mod.ts";
```