feat(cli): add copy argument to Buffer.bytes (#6697)

This commit is contained in:
Marcos Casagrande 2020-07-13 06:58:59 +02:00 committed by GitHub
parent 63edeb1c36
commit 1a96a96e10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 8 deletions

View file

@ -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);
}