MCPcopy Index your code
hub / github.com/ampproject/amphtml / readFromFile

Function readFromFile

validator/js/nodejs/index.js:40–50  ·  view source on GitHub ↗

* Creates a promise which reads from a file. * @param {string} name * @return {Promise }

(name)

Source from the content-addressed store, hash-verified

38 * @return {Promise<string>}
39 */
40function readFromFile(name) {
41 return new Promise(function(resolve, reject) {
42 fs.readFile(name, 'utf8', function(err, data) {
43 if (err) {
44 reject(err);
45 } else {
46 resolve(data.trim());
47 }
48 });
49 });
50}
51
52/**
53 * Creates a promise which reads from a stream.

Callers 2

getInstanceFunction · 0.85
mainFunction · 0.85

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected