JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 194408
  • Score
    100M100P100Q171395F
  • License MIT

Forked the idea of @sole to zip a complete folder into a zip file but now using promises

Package Exports

  • zip-a-folder

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zip-a-folder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NPM

zip-a-folder

Easy to use zip (or tar) a complete folder plain into a zip file including compression ratio handling.

Version 1.0+ is incompatible to elder versions since it introduces a breaking API change.

  • Callback function is NOT supported anymore.
  • Provide the possibility to create tar archives.
  • Set compression ratio (three levels supported by now uncompressed, medium and high)

Basic Usage

Install via npm

npm install zip-a-folder

Creating a ZIP file

import { zip } from 'zip-a-folder';

class TestMe {

    static async main() {
        await zip('/path/to/the/folder', '/path/to/archive.zip');
    }
}

TestMe.main();

Creating a gzipped TAR file

import { tar } from 'zip-a-folder';

class TestMe {

    static async main() {
        await tar('/path/to/the/folder', '/path/to/archive.tgz');
    }
}

TestMe.main();

Compression handling

For the sake of easy use, supported compression levels are (by now): COMPRESSION_LEVEL.high, COMPRESSION_LEVEL.medium or COMPRESSION_LEVEL.uncompressed.

import { zip, COMPRESSION_LEVEL } from 'zip-a-folder';

class TestMe {

    static async main() {
        await zip('/path/to/the/folder', '/path/to/archive.zip', COMPRESSION_LEVEL.high);
    }
}

TestMe.main();

Tests

Tests can be found in /test and run by jest. To run the tests call npm test.

Thanks

  • Special thanks to @sole for her initial work.
  • Thanks to YOONBYEONGIN
  • Thanks to Wunschik
  • Thanks to ratbeard