0.2.2 • Published 7 months ago

slight-stream-archiver v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Slight Stream Archiver

Main Statements npm version

Introduction

A javascript library that can stream zip files requires a WASM environment. It wraps zip-rs to implement streaming archives.

Currently, zip is supported only.

Installation

npm i slight-stream-archiver

Example

import { ensureWasmLoaded, StreamZip, createJsonStringifyDataGenerator, createStringDataGenerator } from 'slight-stream-archiver'
async function work() {
    // Initial WASM
    await ensureWasmLoaded()

    const zip = new StreamZip()
    // add a.txt
    zip.addFile('READMD.md', createStringDataGenerator('Hello World'))
    // add folder "src"
    zip.addFolder('src')
    // add file "/src/package.json"
    zip.addFile('src/package.json', createJsonStringifyDataGenerator({
        name: "playground"
    }))
    // add file "/src/index.js"
    zip.addFile('src/index.js', createStringDataGenerator("const a = 1;"))

    // archive
    const buf = zip.finish()

    // ...
}

License

MIT

0.2.1

7 months ago

0.2.0

7 months ago

0.2.2

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago