fsagent
A few extras for the node.js fs module.
Last updated 12 years ago by jakeluer .
Repository · Original npm · Tarball · package.json
$ npm install fsagent 
SYNC missed versions from official npm registry.

FSAgent

Keep calm and carry on.

The FSAgent is collection of tools that work cross-platform that assist with node.js fs operations.

Compatibility

This module has been tested and confirmed working on:

  • OSX Lion
  • Ubuntu Precise

Installation

This package as available on npm.

npm install fsagent

API

mkdir

Recursive directory construction similiar to mkdir -p on unix.

var dir = path.join(__dirname, 'hello', 'universe');
fsagent.mkdir(dir, 0755, function (err) {
  // ...
});

rmdir

Recursive directory destruction similiar to rm -rf on unix.

var dir = path.join(__dirname, 'hello');
fsagent.rmdir(dir, function (err) {
  // ...
});

watch

Recursive directory observeration using node's fs.watch.

var watch = fsagent.watch(path.join(__dirname, 'hello'));

fsagent.watch returns an event emitter which will emit the following events:

  • watch on every new file/directory watched or created
    • @param {String} file/directory full path
  • create on every file/directory created
    • @param {String} file/directory full path
    • @parma {fs.Stat} node stat object for file/dir
  • change on every file change
    • @param {String} file/directory full path
    • @parma {fs.Stat} node stat object for file/dir
  • delete on every file/directory delete
    • @param {String} file/directory full path
  • unwatch on every file/directory unwatched or deleted
    • @param {String} file/directory full path

Tests

Tests are writting in Mocha using the Chai should BDD assertion library. Make sure you have that installed, clone this repo, install dependacies using npm install.

$ npm test

Contributors

Interested in contributing? Fork to get started. Contact @logicalparadox if you are interested in being regular contributor.

License

(The MIT License)

Copyright (c) 2012 Jake Luer jake@alogicalparadox.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Current Tags

  • 0.4.0                                ...           latest (12 years ago)

5 Versions

  • 0.4.0                                ...           12 years ago
  • 0.3.0                                ...           12 years ago
  • 0.2.1                                ...           12 years ago
  • 0.2.0                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 3
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE