Baz
Baz

Reputation: 2297

Easy lib to zip a folder and sub-folders/files in nodejs without recursing yourself?

Is there any easy lib that can zip an entire folder's contents in a simple line, without having to recurse through the folder structure yourself, along the lines of:

zip('./folder/').output('zipped.js')

Upvotes: 2

Views: 4129

Answers (1)

Baz
Baz

Reputation: 2297

You can use zip-folder like this:

Installation:

npm i zip-folder

Usage:

var zipFolder = require('zip-folder');
 
zipFolder('/path/to/the/folder', '/path/to/archive.zip', function(err) {
    if(err) {
        console.log('oh no!', err);
    } else {
        console.log('EXCELLENT');
    }
});

Upvotes: 3

Related Questions