vlaf-fs
File system used by vlaf
Installation
$ npm install vlaf-fs
Usage
var vfs = require( 'vlaf-fs' );
var cur = vfs.path( process.cwd() );
var sub = cur.sub( 'subpath' );
console.log( 'Full path:', sub.str );
console.log( 'Basename:', sub.basename );
console.log( 'Dirname:', sub.dirname ); // =TODO=
sub.touch(); // makes ./subpath an empty file
sub.unlink(); // removes ./subpath if it's a file
sub.mkdir(); // makes ./subpath a directory
/*
Events:
Fired by all paths:
created ( path )
removed ( path )
modified ( path )
changed ( path ) =TODO=
accessed ( path ) =TODO=
Fired by directories:
dir_event ( path, event ) -- fired by any path in the directory
tree_event ( path, event ) -- fired by any path under the directory tree
sub.on( 'tree_event', function( path, event ) {
console.log( event, 'event fired for ', path );
});
*/
sub.rmdir(); // removes ./subpath if it's an empty directory
sub.rmdir( true ); // removes ./subpath if it's a directory
sub.rm(); // =TODO= removes ./subpath if it's a file or empty directory
sub.rm( true ); // =TODO= removes ./subpath