MCPcopy Create free account
hub / github.com/denoland/std / grow

Method grow

io/buffer.ts:397–403  ·  view source on GitHub ↗

Grows the buffer's capacity, if necessary, to guarantee space for * another `n` bytes. After `.grow(n)`, at least `n` bytes can be written to * the buffer without another allocation. If `n` is negative, `.grow()` will * throw. If the buffer can't grow it will throw an error. * * Based

(n: number)

Source from the content-addressed store, hash-verified

395 * @param n The number of bytes to grow the buffer by.
396 */
397 grow(n: number) {
398 if (n < 0) {
399 throw new Error("Buffer growth cannot be negative");
400 }
401 const m = this.#grow(n);
402 this.#reslice(m);
403 }
404
405 /**
406 * Reads data from `r` until EOF (`null`) and appends it to the buffer,

Callers 3

fnFunction · 0.95
buffer_test.tsFile · 0.45

Calls 2

#growMethod · 0.95
#resliceMethod · 0.95

Tested by

no test coverage detected