mirror of
https://github.com/denoland/deno.git
synced 2025-09-29 13:44:47 +00:00
feat(cli): add copy argument to Buffer.bytes (#6697)
This commit is contained in:
parent
63edeb1c36
commit
1a96a96e10
3 changed files with 47 additions and 8 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue