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

Method reset

streams/buffer.ts:346–349  ·  view source on GitHub ↗

* Resets to an empty buffer. * * @example Basic usage * ```ts * import { assert } from "@std/assert"; * import { Buffer } from "@std/streams/buffer"; * * const array = new Uint8Array([0, 1, 2]); * const buf = new Buffer(array.buffer); * assert(!buf.empty()); * * // R

()

Source from the content-addressed store, hash-verified

344 * ```
345 */
346 reset() {
347 this.#reslice(0);
348 this.#off = 0;
349 }
350
351 #tryGrowByReslice(n: number) {
352 const l = this.#buf.byteLength;

Callers 4

BufferClass · 0.95
truncateMethod · 0.95
#growMethod · 0.95
buffer_test.tsFile · 0.45

Calls 1

#resliceMethod · 0.95

Tested by

no test coverage detected