1.1.11 • Published 2 years ago
file-operator v1.1.11
��# file-operator
const FileOperator = require("file-operator");
// const YAML = require("yamljs");
class MonkeyJSON extends FileOperator {
constructor() {
super("monkey.json");
};
$test() {
this.says = "hoehoehaha";
this["looks like"] = "=�5�";
this.is = "a monkey";
this.lives = "in a tree";
return this;
};
$count() {
this.counter ? this.counter++ : this.counter = 1;
return this;
};
/* optional
$parse(data) {
return YAML.parse(data);
};
$stringify(data) {
return YAML.stringify(data);
};
//*/
};
new MonkeyJSON().$read().$test().$onReady(monkey => monkey.$count()).$write(true).$close(() => {
console.log("closed monkey.json");
});
//
//
////////////////////////////////////////////////////////////////////
//
// An example from https://github.com/BerendKemper/app
//
new FileOperator("./apis.json").$read(true).$onReady(apis => {
app.loadApiRegister(apis);
console.log("Registered Api endpoints:", app.apis);
app.listen();
});
// ...
process.on("SIGINT", () => {
logger.error("Node JS is now shutting down due to pressing ctrl + c"); // filestream-logger
FileOperator.saveAndExitAll({
log: logger.log, // filestream-logger
callback() {
FilestreamLogger.destroyAll(() => process.exit());
}
});
});
1.1.11
2 years ago
1.1.10
2 years ago
1.1.1
2 years ago
1.1.9
2 years ago
1.1.8
2 years ago
1.1.7
2 years ago
1.1.6
2 years ago
1.1.5
2 years ago
1.1.4
2 years ago
1.1.3
2 years ago
1.1.2
2 years ago
1.1.0
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
3 years ago
1.0.10
3 years ago
1.0.9
3 years ago
1.0.8
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.0
3 years ago