* Writes the given data to the buffer. * * @example Usage * ```ts * import { Buffer } from "@std/io/buffer"; * import { assertEquals } from "@std/assert/equals"; * * const buf = new Buffer(); * const data = new TextEncoder().encode("Hello, world!"); * buf.writeSync(data);
(p: Uint8Array)
| 307 | * @returns The number of bytes written. |
| 308 | */ |
| 309 | writeSync(p: Uint8Array): number { |
| 310 | const m = this.#grow(p.byteLength); |
| 311 | return copy(p, this.#buf, m); |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * Writes the given data to the buffer. Resolves to the number of bytes |