npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-unar

v1.0.8

Published

ESM front-end to unar and lsar a command line tool. The universal un-archiver/unpacker to a lot of formats: .zip, zipx, rar, 7z, tar, gzip, bzip2, lzma, cab, msi, cpio, xar, exe, etc...

Downloads

887

Readme

node-unar

NPM

Dependencies Status Node.js CI codecov MaintainabilityRelease

ESM front-end to unar and lsar a command line tool. The universal un-archiver/unpacker to a lot of formats: .zip, zipx, rar, 7z, tar, gzip, bzip2, lzma, cab, msi, cpio, xar, exe, etc....

The necessary cli tool lsar and unar, will be downloaded to package directory at install time, for Windows amd macOS. If your host is Linux, node-sys will be used to install unar onto your system.

Usage

//ESM Node JS v12+
import { list, unpack } from 'node-unar';

// list only:
list(archiveFile, options)
  .then((fileListArray) => {
  })
  .catch((anyError) => {
  });;

// unpack:
unpack(archiveFile, options | outputDirectory)
  .progress((eachFle) => {
  })
  .then((results) => {
    let type = results.type;
    let fileList = results.files;
    let outputDirectory = results.directory;
  })
  .catch((anyError) => {
  });

// unpack: only requested files/directories
unpack(archiveFile, outputDirectory, file | [files], options)
  .progress((eachFle) => {
  })
  .then((results) => {
    let type = results.type;
    let fileList = results.files;
    let outputDirectory = results.directory;
  })
  .catch((anyError) => {
  });

Examples

Example: unpack file

//ESM Node JS v12+
import  { unpack } from 'node-unar';

unpack('test/abc.rar', 'out')
  .progress((files) => {
    console.log('files', files);
  })
  .then((results) => {
    console.log('Archive type: ', results.type);
    console.log('Archive files', results.files);
    console.log('Archive output directory', results.directory);
  })
  .catch((err) => {
    console.error(err);
  });
});

Example: list content

//ESM Node JS v12+
import { list } from 'node-unar';

list('test/abc.rar')
  .then((files) => {
    console.log('files', files);
  })
  .catch((err) => {
    console.error(err);
  });

Options

Key | Possible values | Comment --------- | -----------------------|------------------------------------------------- quiet | true/false (default) | true will reduce logging for unpacking targetDir | <String> | The directory to write the contents of the archive to. Defaults to the current directory. files | <String> | Only unpack this list of files or directories. forceOverwrite | true/false (default) | if null, tmp dir will created automatically forceDirectory | true/false/undefined | Always create a containing directory for the contents of the unpacked archive. By default, a directory is created if there is more than one top-level file or folder. noDirectory | true/false/undefined | Never create a containing directory for the contents of the unpacked archive. noRecursion | true/false/undefined | Do not attempt to extract archives contained in other archives. For instance, when unpacking a .tar.gz file, only unpack the .gz file and not its contents. copyTime | true/false/undefined | Copy the file modification time from the archive file to the containing directory, if one is created. password | <String> | The password to use for decrypting protected archives. passwordEncoding | <String> | The encoding to use for the password for the archive, when it is not known. If not specified, then either the encoding given by the -encoding option or the auto-detected encoding is used. encoding | <String> | The encoding to use for filenames in the archive, when it is not known. If not specified, the program attempts to auto-detect the encoding used. Use "help" or "list" as the argument to give