MCPcopy
hub / github.com/webpack/webpack / _loadFile

Method _loadFile

lib/DotenvPlugin.js:463–470  ·  lib/DotenvPlugin.js::DotenvPlugin._loadFile

* Load a file with proper path resolution * @private * @param {InputFileSystem} fs the input file system * @param {string} file the file to load * @returns {Promise<string>} the content of the file

(fs, file)

Source from the content-addressed store, hash-verified

461 * @returns {Promise<string>} the content of the file
462 */
463 _loadFile(fs, file) {
464 return new Promise((resolve, reject) => {
465 fs.readFile(file, (err, content) => {
466 if (err) reject(err);
467 else resolve(/** @type {Buffer} */ (content).toString() || class="st">"");
468 });
469 });
470 }
471}
472
473module.exports = DotenvPlugin;

Callers 1

_getParsedMethod · 0.95

Calls 3

resolveFunction · 0.85
readFileMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected