summaryrefslogtreecommitdiff
path: root/buffer.ts
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.ts')
-rw-r--r--buffer.ts10
1 files changed, 2 insertions, 8 deletions
diff --git a/buffer.ts b/buffer.ts
index ba2715cef..d177bc18d 100644
--- a/buffer.ts
+++ b/buffer.ts
@@ -120,10 +120,7 @@ export class Buffer implements Reader, Writer {
* is drained. The return value n is the number of bytes read. If the
* buffer has no data to return, eof in the response will be true.
*/
- async read(p: ArrayBufferView): Promise<ReadResult> {
- if (!(p instanceof Uint8Array)) {
- throw Error("Only Uint8Array supported");
- }
+ async read(p: Uint8Array): Promise<ReadResult> {
if (this.empty()) {
// Buffer is empty, reset to recover space.
this.reset();
@@ -139,11 +136,8 @@ export class Buffer implements Reader, Writer {
return { nread, eof: false };
}
- async write(p: ArrayBufferView): Promise<number> {
+ async write(p: Uint8Array): Promise<number> {
const m = this._grow(p.byteLength);
- if (!(p instanceof Uint8Array)) {
- throw Error("Only Uint8Array supported");
- }
return copyBytes(this.buf, p, m);
}