Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/kagis/zipcat

Catenates multiple byte-streams into zip-stream
https://github.com/kagis/zipcat

create-zip create-zip-file zip zipjs

Last synced: about 1 month ago
JSON representation

Catenates multiple byte-streams into zip-stream

Awesome Lists containing this project

README

        

# zipcat

```js
import { zipcat } from 'https://raw.githubusercontent.com/kagis/zipcat/c2fc55f65f33c1576ae5cd9c6ed6e5999dc7f032/zipcat.js';
import { readableStreamFromIterable } from 'https://deno.land/[email protected]/streams/mod.ts';

await readableStreamFromIterable(zipcat(generate_zip_entries())).pipeTo(Deno.stdout.writable);

async function * generate_zip_entries() {
yield { name: 'one.txt', data: utf8enc('hello world\n') };
yield { name: 'two.txt', data: [utf8enc('lorem ipsum\n'), utf8enc('dolor sit amet\n')] };

const file = await Deno.open('/tmp/three.txt');
yield { name: 'three.txt', data: file.readable };
}

function utf8enc(s) {
return new TextEncoder().encode(s);
}
```