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

Method _streamFile

deps/v8/tools/js/web-api-helper.mjs:158–171  ·  view source on GitHub ↗
(file, decoder)

Source from the content-addressed store, hash-verified

156 }
157
158 async _streamFile(file, decoder) {
159 const stream = file.stream().pipeThrough(new decoder());
160 const reader = stream.getReader();
161 let chunk, readerDone;
162 do {
163 const readResult = await reader.read();
164 chunk = readResult.value;
165 readerDone = readResult.done;
166 if (!chunk) break;
167 this._handleFileChunk(chunk);
168 // Artificial delay to allow for layout updates.
169 await delay(5);
170 } while (!readerDone);
171 }
172
173 _handleFileChunk(chunk) {
174 this.dispatchEvent(new CustomEvent('fileuploadchunk', {

Callers 1

asyncReadFileMethod · 0.95

Calls 6

_handleFileChunkMethod · 0.95
delayFunction · 0.90
pipeThroughMethod · 0.80
getReaderMethod · 0.80
streamMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected