https://github.com/zebp/streaming-multipart
streaming-multipart
https://github.com/zebp/streaming-multipart
Last synced: about 2 months ago
JSON representation
streaming-multipart
- Host: GitHub
- URL: https://github.com/zebp/streaming-multipart
- Owner: zebp
- Created: 2023-02-20T19:06:10.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-08T13:52:07.000Z (about 2 years ago)
- Last Synced: 2025-03-15T08:12:33.696Z (2 months ago)
- Language: TypeScript
- Size: 11.7 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
streaming-multipart
A streaming multipart reader and writer for Web-compatible JavaScript runtimes with zero dependencies.```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";
```