Skip to content

Commit ecb4c02

Browse files
authored
Explicitly call out what to do on the end of the compressed input (#77)
Fixes #76 by explicitly queuing all decompressed data before erroring the stream.
1 parent 669633f commit ecb4c02

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

index.bs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,16 @@ The <dfn>decompress and enqueue a chunk</dfn> algorithm, given a {{Decompression
139139
1. If |buffer| is empty, return.
140140
1. Let |arrays| be the result of splitting |buffer| into one or more non-empty pieces and converting them into {{Uint8Array}}s.
141141
1. [=list/For each=] {{Uint8Array}} |array| of |arrays|, [=TransformStream/enqueue=] |array| in |ds|'s [=GenericTransformStream/transform=].
142+
1. If the end of the compressed input has been reached, and |ds|'s [=DecompressionStream/context=] has not fully consumed |chunk|, then throw a {{TypeError}}.
142143
</div>
143144

144145
<div algorithm>
145146
The <dfn>decompress flush and enqueue</dfn> algorithm, which handles the end of data from the input {{ReadableStream}} object, given a {{DecompressionStream}} object |ds|, runs these steps:
146147
1. Let |buffer| be the result of decompressing an empty input with |ds|'s <a for=DecompressionStream>format</a> and <a for=DecompressionStream>context</a>, with the finish flag.
148+
1. If |buffer| is not empty:
149+
1. Let |arrays| be the result of splitting |buffer| into one or more non-empty pieces and converting them into {{Uint8Array}}s.
150+
1. [=list/For each=] {{Uint8Array}} |array| of |arrays|, [=TransformStream/enqueue=] |array| in |ds|'s [=GenericTransformStream/transform=].
147151
1. If the end of the compressed input has not been reached, then throw a {{TypeError}}.
148-
1. If |buffer| is empty, return.
149-
1. Let |arrays| be the result of splitting |buffer| into one or more non-empty pieces and converting them into {{Uint8Array}}s.
150-
1. [=list/For each=] {{Uint8Array}} |array| of |arrays|, [=TransformStream/enqueue=] |array| in |ds|'s [=GenericTransformStream/transform=].
151152
</div>
152153

153154

0 commit comments

Comments
 (0)