Giter VIP home page Giter VIP logo

7zip-min's Introduction

7zip-min

Minimal cross-platform pack/unpack (and any command) with 7-zip for Node.js.
It does not require 7zip to be installed in your system. This package includes standalone 7za version of 7-Zip (uses precompiled binaries from 7zip-bin package).

Supporting archive formats

According to Command Line Version User's Guide page, 7za supports only 7z, lzma, cab, zip, gzip, bzip2, Z and tar formats.

Supporting platforms

  • win (32/64)
  • mac
  • linux
    • arm
    • arm64
    • ia32
    • x64

To get more details check 7zip-bin package repo.

Usage

You may use pack and unpack methods for simple packing/unpacking.

You can also use list to get an array with the file content properties (includes date, time, attr, size, compressed and name)

Or use cmd to run 7za with custom parameters (see Command Line Version User's Guide)

const _7z = require('7zip-min');

// unpack
_7z.unpack('path/to/archive.7z', 'where/to/unpack', err => {
    // done
});

// unpack into the current directory (process.cwd()) if no output directory specified
_7z.unpack('path/to/archive.7z', err => {
    // done
});

// pack
_7z.pack('path/to/dir/or/file', 'path/to/archive.7z', err => {
    // done
});

// list
_7z.list('path/to/archive.7z', (err, result) => {
    // in result you will have an array with info list for your archive
    // for each element in archive you will have:
    // name, date, time, attr, size (in bytes), compressed (compressed size in bytes), crc, method, encrtypted, block
    // depeneds on archive type some values may be empty or missed
});

// cmd
// in the first parameter you have to provide array of parameters
// check 7z's Command Line Version User's Guide - https://sevenzip.osdn.jp/chm/cmdline/index.htm
// the bellow command is equal to `7za a path/to/archive.7z path/to/dir/or/file` and will add `path/to/dir/or/file` to `path/to/archive.7z` archive
_7z.cmd(['a', 'path/to/archive.7z', 'path/to/dir/or/file'], err => {
    // done
});

Test

npm test

7zip-min's People

Contributors

aqblanco avatar dependabot-preview[bot] avatar dependabot[bot] avatar onikienko avatar richabharti1 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.