Utility functions for file system, debugging, logging your Node.js application.
First ensure that you have Node.js installed and then run the following:
npm install utilityFileSystem
Note: I would love to hear from the people downloading this package about their reasons and what improvements they would like to see. Feel free to contact me at chuankengchou@gmail.com
Require the module for an instance of utilityFileSystem
var utility = require('./utilityFileSystem');
//create few files...
utility.export('./sample.txt','content...');
Output:
Created file: ./sample.txt
var utility = require('./utilityFileSystem');
utility.readFile("./sample.txt");
Output:
Reading file contents from ./sample.txt
var utility = require('./utilityFileSystem');
utility.readFolder("./package.json");
utility.readFolder("./sample");
Output:
./package.json Target exists, but it is not a folder...use utility.readFile() instead.
./sample Folder exists and its contents are: test.txt,test1.txt,test2.txt,test3.txt,test4.txt
var obj = {jimmy: "chou"};
utility.logger(obj);
Output:
{"jimmy":"chou"}
Created file: ./logs/2017-11-06T02:00:29.297Z.txt
To run the test suite, first install any dependencies and then run npm test
:
npm install
npm test
The logging capability is aware of the process running. For example, if there is an existing logging file, any new instance of fileUtility will append to the existing.