1.0.6 • Published 3 years ago
@xeerx/nodejs-files v1.0.6
xeerx nodeJS files system
Install
npm i @xeerx/nodejs-files
const xfiles = require('@xeerx/nodejs-files');
Functions
read exists file
// async => string | false
xfiles.read(path,e ncoding='utf8');
write exists file
// async => true | false
xfiles.write(path, data='', encoding='utf8');
get file info
// async => object[stat] | false
xfiles.info(path);
delete file/folder
// async => true | false
xfiles.delete(path);
on file update execute function
// async => true | false
xfiles.watch(path, callback);
on file update execute function(currstat,prevstat)
// async => true | false
xfiles.watchUpdates(path, callback);
check if file/folder exists
// async => true | false
xfiles.exists(path);
check if path is directoryFolder
// async => true | false
xfiles.isDir(path);
create file if not exists
// async => true | false
xfiles.file(path,data='',options={encoding:'utf8'});
get all files in path as array
// async => array | false
xfiles.files(path);
create folder if not exists
// async => true | false
xfiles.folder(path,options={});
get all folders in path as array
// async => array | false
xfiles.folders(path);
get files and sub files tree in path as array
// async => array
xfiles.tree(path);
create folders/files with contents from object
// async => undefined
xfiles.workspace(object,path);