rat

Recursive asynchronous file operations for node.js

Rat

Recursive asynchronous file operations for node.js

Install Rat using npm:

npm install --global rat
var rat = require('rat');

path String
options Map. Optional.
callback Function(err, files)

List files and directories in path. The files callback argument is an array of objects with properties, path and stats being the file's path and associated fs.Stats object.

rat.list('/my/files', function(err, files) {
  if (err) throw err;
  console.log(files);
});

Show hidden files

rat.list('/my/files', {hidden: true}, function(err, files) {
  if (err) throw err;
  console.log(files);
});

You can limit the number of file descriptors opened at once with the limit option:

rat.list('/my/files', {limit: 24}, function(err, files) {
  if (err) throw err;
  console.log(files);
});

Alias for rat.list().

Synchronous version of rat.list().

Alias for rat.listSync().

source String
destination String
options Map. Optional.
callback Function(err)

Copy source to destination recursively. Preserves permissions, symbolic links, and hidden files.

rat.copy('/source/files', '/dest/files', function(err) {
  if (err) throw err;
});

You can limit the number of file descriptors opened at once with the limit option:

rat.copy('/source/files', '/dest/files', {limit: 24}, function(errors) {
  if (errors) console.log(errors);
});

Alias for rat.copy().

path String
callback Function(err, stats)

Remove path and files within.

rat.remove('/my/files', function(err, stats) {
  if (err) throw err;
  console.log(stats);
});

Alias for rat.remove().

If you like using rat, tip me some bits @ 1MUaP1e5DcuWrup7nLwK1rBfLR7YCcjnqS