summaryrefslogtreecommitdiff
path: root/cli/js/buffer.ts
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2020-07-13 06:58:59 +0200
committerGitHub <noreply@github.com>2020-07-13 00:58:59 -0400
commit1a96a96e101140a2c39114710f93ab21c98fca01 (patch)
treefe2166564dfad2c34dbbaec2cd72b51446b1d26f /cli/js/buffer.ts
parent63edeb1c36bfcea278c248e8be92f7dbb75f7671 (diff)
feat(cli): add copy argument to Buffer.bytes (#6697)
Diffstat (limited to 'cli/js/buffer.ts')
-rw-r--r--cli/js/buffer.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/js/buffer.ts b/cli/js/buffer.ts
index 3308a9a0c..4f88ff625 100644
--- a/cli/js/buffer.ts
+++ b/cli/js/buffer.ts
@@ -39,7 +39,8 @@ export class Buffer implements Reader, ReaderSync, Writer, WriterSync {
this.#buf = new Uint8Array(ab);
}
- bytes(): Uint8Array {
+ bytes(options: { copy?: boolean } = { copy: true }): Uint8Array {
+ if (options.copy === false) return this.#buf.subarray(this.#off);
return this.#buf.slice(this.#off);
}