Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

Create ReadableStreams from multipart forms without allocating the entire form on the heap
https://github.com/zebp/multipart-stream

deno typescript

Last synced: 4 months ago
JSON representation

Create ReadableStreams from multipart forms without allocating the entire form on the heap

Awesome Lists containing this project

README

        

# multipart-stream

Create ReadableStreams from multipart forms without allocating the entire form
on the heap.

## Example

```typescript
import { streamFromMultipart } from "https://deno.land/x/multipart_stream/mod.ts";

const [stream, boundary] = streamFromMultipart(async (multipartWriter) => {
const file = await Deno.open("test.bin");
await multipartWriter.writeFile("file", "test.bin", file);
file.close();
});

await fetch("http://example.com/upload", {
headers: {
"Content-Type": `multipart/form-data; boundary=${boundary}`,
},
body: stream,
method: "POST",
});
```