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

Method openAsBlob

lib/internal/vfs/file_system.js:557–563  ·  view source on GitHub ↗

* Opens a file as a Blob. * @param {string} filePath The file path * @param {object} [options] Options * @returns {Blob} The file content as a Blob

(filePath, options)

Source from the content-addressed store, hash-verified

555 * @returns {Blob} The file content as a Blob
556 */
557 openAsBlob(filePath, options) {
558 const { Blob } = require('buffer');
559 const providerPath = this.#toProviderPath(filePath);
560 const content = this[kProvider].readFileSync(providerPath);
561 const type = options?.type || '';
562 return new Blob([content], { type });
563 }
564
565 // ==================== File Descriptor Operations ====================
566

Callers 4

openAsBlobFunction · 0.80
openAsBlobFunction · 0.80
fs-read.jsFile · 0.80

Calls 3

#toProviderPathMethod · 0.95
requireFunction · 0.50
readFileSyncMethod · 0.45

Tested by

no test coverage detected