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

https://github.com/mtsewrs/partzilla

Multipart parser for node and bun
https://github.com/mtsewrs/partzilla

bun library multipart node nodejs npm-package parser rust typescript

Last synced: 4 months ago
JSON representation

Multipart parser for node and bun

Awesome Lists containing this project

README

          



⚡️ Modern multipart parser written in rust and typescript for node and bun



NPM Version
NPM Downloads

## Install

```bash
pnpm install partzilla
bun install partzilla
yarn install partzilla
npm install partzilla
```

## Usage node

```typescript
import { partzilla } from "partzilla";

createServer(async (req, res) => {
const files = partzilla(req);

await multipart.next(async (file) => {
// file is of type MultipartFile
console.log(file.name);
console.log(file.filename);
console.log(file.contentType);
const stream = file.stream(); // ReadableStream
});
res.end("Node!");
});
```

## Usage bun

```typescript
import { partzilla } from "partzilla";

Bun.serve({
async fetch(req) {
const files = partzilla(req);

await multipart.next(async (file) => {
// file is of type MultipartFile
console.log(file.name);
console.log(file.filename);
console.log(file.contentType);
const stream = file.stream(); // ReadableStream
});
return new Response("Bun!");
},
});
```

## MultipartFile

```typescript
interface MultipartFile {
name?: string;
filename?: string;
contentType?: string;
stream(): ReadableStream;
}
```