MCPcopy
hub / github.com/exceljs/exceljs / read

Function read

lib/utils/stream-buf.js:308–328  ·  view source on GitHub ↗
(size)

Source from the content-addressed store, hash-verified

306 // event close - optional, indicates upstream close
307 // event error - duh
308 read(size) {
309 let buffers;
310 // read min(buffer, size || infinity)
311 if (size) {
312 buffers = [];
313 while (size && this.buffers.length && !this.buffers[0].eod) {
314 const first = this.buffers[0];
315 const buffer = first.read(size);
316 size -= buffer.length;
317 buffers.push(buffer);
318 if (first.eod && first.full) {
319 this.buffers.shift();
320 }
321 }
322 return Buffer.concat(buffers);
323 }
324
325 buffers = this.buffers.map(buf => buf.toBuffer()).filter(Boolean);
326 this.buffers = [];
327 return Buffer.concat(buffers);
328 },
329 setEncoding(encoding) {
330 // causes stream.read or stream.on('data) to return strings of encoding instead of Buffer objects
331 this.encoding = encoding;

Callers

nothing calls this directly

Calls 4

readMethod · 0.65
mapMethod · 0.65
pushMethod · 0.45
toBufferMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…