diff --git a/index.bs b/index.bs index 4e45c3b..4a37586 100644 --- a/index.bs +++ b/index.bs @@ -79,27 +79,32 @@ CompressionStream includes GenericTransformStream; A {{CompressionStream}} has an associated format and compression context context. +
new CompressionStream(|format|) steps are:
- 1. If *format* is unsupported in {{CompressionStream}}, then throw a {{TypeError}}.
- 1. Set [=this=]'s format to *format*.
- 1. Let *transformAlgorithm* be an algorithm which takes a *chunk* argument and runs the compress and enqueue a chunk algorithm with [=this=] and *chunk*.
- 1. Let *flushAlgorithm* be an algorithm which takes no argument and runs the compress flush and enqueue algorithm with [=this=].
+ 1. If |format| is unsupported in {{CompressionStream}}, then throw a {{TypeError}}.
+ 1. Set [=this=]'s format to |format|.
+ 1. Let |transformAlgorithm| be an algorithm which takes a |chunk| argument and runs the compress and enqueue a chunk algorithm with [=this=] and |chunk|.
+ 1. Let |flushAlgorithm| be an algorithm which takes no argument and runs the compress flush and enqueue algorithm with [=this=].
1. Set [=this=]'s [=GenericTransformStream/transform=] to a [=new=] {{TransformStream}}.
- 1. [=TransformStream/Set up=] [=this=]'s [=GenericTransformStream/transform=] with [=TransformStream/set up/transformAlgorithm=] set to *transformAlgorithm* and [=TransformStream/set up/flushAlgorithm=] set to *flushAlgorithm*.
-
-The compress and enqueue a chunk algorithm, given a {{CompressionStream}} object *cs* and a *chunk*, runs these steps:
- 1. If *chunk* is not a {{BufferSource}} type, then throw a {{TypeError}}.
- 1. Let *buffer* be the result of compressing *chunk* with *cs*'s format and context.
- 1. If *buffer* is empty, return.
- 1. Split *buffer* into one or more non-empty pieces and convert them into {{Uint8Array}}s.
- 1. For each {{Uint8Array}} *array*, [=TransformStream/enqueue=] *array* in *cs*'s [=GenericTransformStream/transform=].
+ 1. [=TransformStream/Set up=] [=this=]'s [=GenericTransformStream/transform=] with [=TransformStream/set up/transformAlgorithm=] set to |transformAlgorithm| and [=TransformStream/set up/flushAlgorithm=] set to |flushAlgorithm|.
+new DecompressionStream(|format|) steps are:
- 1. If *format* is unsupported in {{DecompressionStream}}, then throw a {{TypeError}}.
- 1. Set [=this=]'s format to *format*.
- 1. Let *transformAlgorithm* be an algorithm which takes a *chunk* argument and runs the decompress and enqueue a chunk algorithm with [=this=] and *chunk*.
- 1. Let *flushAlgorithm* be an algorithm which takes no argument and runs the decompress flush and enqueue algorithm with [=this=].
+ 1. If |format| is unsupported in {{DecompressionStream}}, then throw a {{TypeError}}.
+ 1. Set [=this=]'s format to |format|.
+ 1. Let |transformAlgorithm| be an algorithm which takes a |chunk| argument and runs the decompress and enqueue a chunk algorithm with [=this=] and |chunk|.
+ 1. Let |flushAlgorithm| be an algorithm which takes no argument and runs the decompress flush and enqueue algorithm with [=this=].
1. Set [=this=]'s [=GenericTransformStream/transform=] to a [=new=] {{TransformStream}}.
- 1. [=TransformStream/Set up=] [=this=]'s [=GenericTransformStream/transform=] with [=TransformStream/set up/transformAlgorithm=] set to *transformAlgorithm* and [=TransformStream/set up/flushAlgorithm=] set to *flushAlgorithm*.
-
-The decompress and enqueue a chunk algorithm, given a {{DecompressionStream}} object *ds* and a *chunk*, runs these steps:
- 1. If *chunk* is not a {{BufferSource}} type, then throw a {{TypeError}}.
- 1. Let *buffer* be the result of decompressing *chunk* with *ds*'s format and context. If this results in an error, then throw a {{TypeError}}.
- 1. If *buffer* is empty, return.
- 1. Split *buffer* into one or more non-empty pieces and convert them into {{Uint8Array}}s.
- 1. For each {{Uint8Array}} *array*, [=TransformStream/enqueue=] *array* in *ds*'s [=GenericTransformStream/transform=].
+ 1. [=TransformStream/Set up=] [=this=]'s [=GenericTransformStream/transform=] with [=TransformStream/set up/transformAlgorithm=] set to |transformAlgorithm| and [=TransformStream/set up/flushAlgorithm=] set to |flushAlgorithm|.
+