MCPcopy Index your code
hub / github.com/nodejs/node / readAsFetch

Method readAsFetch

test/common/wpt.js:221–231  ·  view source on GitHub ↗

* Load a resource in test/fixtures/wpt specified with a URL * @param {string} from the path of the file loading this resource, * relative to the WPT folder. * @param {string} url the url of the resource being loaded. * @returns {Promise<{ * ok: string, * arrayBuffer: function

(from, url)

Source from the content-addressed store, hash-verified

219 * }>}
220 */
221 async readAsFetch(from, url) {
222 const file = this.toRealFilePath(from, url);
223 const data = await fsPromises.readFile(file);
224 return {
225 ok: true,
226 arrayBuffer() { return data.buffer; },
227 bytes() { return new Uint8Array(data); },
228 json() { return JSON.parse(data.toString()); },
229 text() { return data.toString(); },
230 };
231 }
232}
233
234class StatusRule {

Callers 1

worker.jsFile · 0.80

Calls 2

toRealFilePathMethod · 0.95
readFileMethod · 0.45

Tested by

no test coverage detected