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

Function getSource

lib/internal/blob.js:109–127  ·  view source on GitHub ↗
(source, endings)

Source from the content-addressed store, hash-verified

107}
108
109function getSource(source, endings) {
110 if (isBlob(source))
111 return [source.size, source[kHandle]];
112
113 if (isAnyArrayBuffer(source)) {
114 source = new Uint8Array(source);
115 } else if (!isArrayBufferView(source)) {
116 if (endings === 'native')
117 source = RegExpPrototypeSymbolReplace(/\n|\r\n/g, source, EOL);
118 source = enc.encode(source);
119 }
120
121 // We copy into a new Uint8Array because the underlying
122 // BackingStores are going to be detached and owned by
123 // the Blob.
124 const { buffer, byteOffset, byteLength } = source;
125 const slice = buffer.slice(byteOffset, byteOffset + byteLength);
126 return [byteLength, new Uint8Array(slice)];
127}
128
129const sourcesConverter = createSequenceConverter((source, opts = kEmptyObject) => {
130 if (isBlob(source) || isAnyArrayBuffer(source) || isArrayBufferView(source)) {

Callers 1

constructorMethod · 0.70

Calls 3

isBlobFunction · 0.85
encodeMethod · 0.80
sliceMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…