* 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)
| 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 | } |
no test coverage detected