Plato on Github
Report Home
src/read/nodejs.js
Maintainability
84.92
Lines of code
24
Difficulty
5.37
Estimated Errors
0.06
Function weight
By Complexity
By SLOC
/** * @file NodeJS read implementation * @since 0.2.6 */ /*#ifndef(UMD)*/ "use strict"; /*global _GPF_HOST*/ // Host types /*global _gpfNodeFs*/ // Node/PhantomJS require("fs") /*global _gpfReadSetImplIf*/ // Set the read implementation if the host matches /*#endif*/ function _gpfReadNodeJS (path) { return new Promise(function (resolve, reject) { _gpfNodeFs.readFile(path, function (err, data) { if (err) { reject(err); } else { resolve(data.toString()); } }); }); } _gpfReadSetImplIf(_GPF_HOST.NODEJS, _gpfReadNodeJS);