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. +
The 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|. +
-The compress flush and enqueue algorithm, which handles the end of data from the input {{ReadableStream}} object, given a {{CompressionStream}} object *cs*, runs these steps: +
+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. Let *buffer* be the result of compressing an empty input with *cs*'s format and context, with the finish flag. - 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=]. +
+The compress flush and enqueue algorithm, which handles the end of data from the input {{ReadableStream}} object, given a {{CompressionStream}} object |cs|, runs these steps: + 1. Let |buffer| be the result of compressing an empty input with |cs|'s format and context, with the finish flag. + 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=]. +
# Interface `DecompressionStream` # {#decompression-stream} @@ -114,28 +119,33 @@ DecompressionStream includes GenericTransformStream; A {{DecompressionStream}} has an associated format and compression context context. +
The 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|. +
-The decompress flush and enqueue algorithm, which handles the end of data from the input {{ReadableStream}} object, given a {{DecompressionStream}} object *ds*, runs these steps: +
+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. Let *buffer* be the result of decompressing an empty input with *ds*'s format and context, with the finish flag. +
+The decompress flush and enqueue algorithm, which handles the end of data from the input {{ReadableStream}} object, given a {{DecompressionStream}} object |ds|, runs these steps: + 1. Let |buffer| be the result of decompressing an empty input with |ds|'s format and context, with the finish flag. 1. If the end of the compressed input has not been reached, 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. 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=]. +
# Privacy and security considerations # {#privacy-security}