standalone-unrar

A standalone unrar library without any need for external dependencies.

Usage no npm install needed!

<script type="module">
  import standaloneUnrar from 'https://cdn.skypack.dev/standalone-unrar';
</script>

README

standalone-unrar NPM version

A standalone unrar library without any need for external dependencies. This library has the Unarchiver unar and lsar tools bundled. You can download the tools separately or see the source code here, if needed: http://unarchiver.c3.cx/commandline

Install

npm install --save standalone-unrar

API

Members

unpackChildProcess

Function for unpacking an archived file.

listChildProcess

Function for unpacking an archived file.

Functions

unrar(archive)Object

Completely standalone unrar library for node. Is bundled with unrar and rar list tools, so there is no need for external dependencies.

Currently only works on Mac OS X.

This is a convenience function for list and unpack to avoid repeting the archive path. This means unrar(path).unpack(func) is the same as unrar.unpack(path, func)

unpack ⇒ ChildProcess

Function for unpacking an archived file.

Kind: global variable Returns: ChildProcess - Result from execution

Param Type Description
archive String path to archive to operate on
arguments Object Arguments passed to unar tool.
options Object Options passed to execution of the unar tool.
callback function Callback when data is unpacked

Example

unrar.unpack('pathTo.rar', function (err, output) {

});
unrar.unpack('pathTo.rar', { password: 'pwd' }, function (err, output) {

});

list ⇒ ChildProcess

Function for unpacking an archived file.

Kind: global variable Returns: ChildProcess - Result from execution

Param Type Description
archive String path to archive to operate on
arguments Object Arguments passed to unar tool.
options Object Options passed to execution of the unar tool.
callback function Callback when data is unpacked

Example

unrar.list('pathTo.rar', function (err, entries) {
 // entries is a list of file names in the archive
});
unrar.list('pathTo.rar', { verbose: true }, function (err, output) {
 // entries is a complex object with details of all entries
});

unrar(archive) ⇒ Object

Completely standalone unrar library for node. Is bundled with unrar and rar list tools, so there is no need for external dependencies.

Currently only works on Mac OS X.

This is a convenience function for list and unpack to avoid repeting the archive path. This means unrar(path).unpack(func) is the same as unrar.unpack(path, func)

Kind: global function Returns: Object - functions unrar and list that operate on archive See

  • unpack
  • list
Param Type Description
archive String path to archive to operate on

Example

unrar('pathTo.rar').unpack(function (err, output) {

});
unrar('pathTo.rar').list(function (err, entries) {

});
unrar('pathTo.rar').list({
 // Arguments (same as unar and lsar):
 verbose: true,
 password: 'Password'
}, {
 // Options to execution
 cwd: 'someRoot'
}, function (err, entries) {

});