We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6fee456 commit 18f537eCopy full SHA for 18f537e
src/index.ts
@@ -1,8 +1,12 @@
1
import BufferList from 'bl/BufferList.js'
2
import type { Source } from 'it-stream-types'
3
4
+export interface Reader extends AsyncGenerator<BufferList, void, any> {
5
+ next: (...args: [] | [number]) => Promise<IteratorResult<BufferList, void>>
6
+}
7
+
8
export function reader (source: Source<Uint8Array>) {
- const reader = (async function * (): AsyncGenerator<BufferList, void, any> {
9
+ const reader: Reader = (async function * (): AsyncGenerator<BufferList, void, any> {
10
// @ts-expect-error first yield in stream is ignored
11
let bytes: number | undefined = yield // Allows us to receive 8 when reader.next(8) is called
12
let bl = new BufferList()
0 commit comments