summaryrefslogtreecommitdiff
path: root/js/io.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/io.ts')
-rw-r--r--js/io.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/js/io.ts b/js/io.ts
index 4e37355bb..74b30cd94 100644
--- a/js/io.ts
+++ b/js/io.ts
@@ -37,7 +37,7 @@ export interface Reader {
*
* Implementations must not retain `p`.
*/
- read(p: ArrayBufferView): Promise<ReadResult>;
+ read(p: Uint8Array): Promise<ReadResult>;
}
// Writer is the interface that wraps the basic write() method.
@@ -51,7 +51,7 @@ export interface Writer {
*
* Implementations must not retain `p`.
*/
- write(p: ArrayBufferView): Promise<number>;
+ write(p: Uint8Array): Promise<number>;
}
// https://golang.org/pkg/io/#Closer
@@ -123,9 +123,7 @@ export async function copy(dst: Writer, src: Reader): Promise<number> {
* console.log(chunk)
* }
*/
-export function toAsyncIterator(
- r: Reader
-): AsyncIterableIterator<ArrayBufferView> {
+export function toAsyncIterator(r: Reader): AsyncIterableIterator<Uint8Array> {
const b = new Uint8Array(1024);
return {
@@ -133,7 +131,7 @@ export function toAsyncIterator(
return this;
},
- async next(): Promise<IteratorResult<ArrayBufferView>> {
+ async next(): Promise<IteratorResult<Uint8Array>> {
const result = await r.read(b);
return {
value: b.subarray(0, result.nread),