diff --git a/src/util/stream.ts b/src/util/stream.ts index e692f3d..995acec 100644 --- a/src/util/stream.ts +++ b/src/util/stream.ts @@ -113,7 +113,6 @@ export function createWritable(): StreamWritable { }, error(reason: unknown) { error = reason; - done = true; buf = ""; if (pending) { @@ -122,10 +121,6 @@ export function createWritable(): StreamWritable { } }, async next() { - if (error) { - throw error; - } - if (buf) { const value = buf; buf = ""; @@ -142,6 +137,10 @@ export function createWritable(): StreamWritable { }; } + if (error) { + throw error; + } + await (pending = createDeferred()); return this.next(); },