diff options
Diffstat (limited to 'js/io.ts')
-rw-r--r-- | js/io.ts | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -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), |