0.6.0 • Published 8 years ago

auto-unrar v0.6.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 years ago

auto-unrar NPM version

Functions

autoUnrar(cwd, callback)

Unrar all files recursively if they don't exits given by a entry point root directory.

Kind: global function

ParamTypeDescription
cwdStringPath to search for rar-files
callbackfunctionCallback after all data has been unpacked

Example

autoUnrar('~/Documents/myDirectory', function (err, data) {
  // data is an object with archives as keys and entries on data.
  // example:
  // {
  //   'some-file.rar': {
  //     skip: false,
  //     outputFile: 'some/path/some-file.dat',
  //     entry: 'some-file'
  //   }
  // }
});

Example CLI Usage

auto-unrar

  Automatic unpack all recursive rar-files from a directory.

Options

  -h, --help              Display this usage info
  -v, --verbose           Log all information
  --cwd string            What folder to use as base directory (root search directory)
  -i, --interval number   Set interval in minutes for periodic check. Default value is 5 minutes.

  Full help (project repo): https://github.com/mikaelbr/auto-unrar

poll(options, callback) ⇒ function

Automatically poll defined by interval recursively from root defined as cwd from the options.

Kind: global function Returns: function - Function to stop polling for packages.

ParamTypeDescription
optionsString | ObjectPath to search for rar-files or options object
options.cwdStringPath to search for rar-files
options.intervalNumberPolling interval in minutes
options.beforeHookfunctionHook before each unpacking search
callbackfunctionCallback after all data has been unpacked

Example

autoUnrar.poll('~/Documents/myDirectory', function (err, data) {
  // data is an object with archives as keys and entries on data.
  // example:
  // {
  //   'some-file.rar': {
  //     skip: false,
  //     outputFile: 'some/path/some-file.dat',
  //     entry: 'some-file'
  //   }
  // }
});

autoUnrar.poll({
  cwd: '~/Documents/myDirectory',
  interval: 10, // every 10 mintues
  beforeHook: function () { console.log('About to search for files') }
}, function (err, data) {

});