rat

    1.1.1 • Public • Published

    Rat

    Recursive asynchronous file operations for node.js

    Install

    Install Rat using npm:

    npm install --global rat
    

    API

    var rat = require('rat');
    

    rat.list(path, callback)

    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);
    });
    

    rat.ls()

    Alias for rat.list().

    rat.listSync()

    Synchronous version of rat.list().

    rat.lsSync()

    Alias for rat.listSync().

    rat.copy(source, destination, [options,] callback)

    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);
    });
    

    rat.cp()

    Alias for rat.copy().

    rat.remove(path, callback)

    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);
    });
    

    rat.rm()

    Alias for rat.remove().

    Donations

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

    Keywords

    none

    Install

    npm i rat

    DownloadsWeekly Downloads

    2

    Version

    1.1.1

    License

    none

    Last publish

    Collaborators

    • amingoia