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

Method grow

streams/buffer.ts:422–430  ·  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. * * @pa

(n: number)

Source from the content-addressed store, hash-verified

420 * ```
421 */
422 grow(n: number) {
423 if (n < 0) {
424 throw new RangeError(
425 `Cannot grow buffer as growth must be positive: received ${n}`,
426 );
427 }
428 const m = this.#grow(n);
429 this.#reslice(m);
430 }
431}

Callers 1

buffer_test.tsFile · 0.45

Calls 2

#growMethod · 0.95
#resliceMethod · 0.95

Tested by

no test coverage detected