MCPcopy Index your code
hub / github.com/nodejs/node / #actualWriteBuffer

Method #actualWriteBuffer

lib/internal/streams/fast-utf8-stream.js:579–597  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

577 }
578
579 #actualWriteBuffer() {
580 this.#writing = true;
581 this.#writingBuf = this.#writingBuf.length ? this.#writingBuf : mergeBuf(this.#bufs.shift(), this.#lens.shift());
582
583 if (this.#sync) {
584 try {
585 const written = this.#fs.writeSync(this.#fd, this.#writingBuf);
586 this.#release(null, written);
587 } catch (err) {
588 this.#release(err);
589 }
590 } else {
591 // fs.write will need to copy string to buffer anyway so
592 // we do it here to avoid the overhead of calculating the buffer size
593 // in releaseWritingBuf.
594 this.#writingBuf = Buffer.from(this.#writingBuf);
595 this.#fs.write(this.#fd, this.#writingBuf, (...args) => this.#release(...args));
596 }
597 }
598
599 #actualWriteUtf8() {
600 this.#writing = true;

Callers 1

constructorMethod · 0.95

Calls 6

#releaseMethod · 0.95
mergeBufFunction · 0.85
shiftMethod · 0.45
writeSyncMethod · 0.45
fromMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected