You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.bs
+44-34Lines changed: 44 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -79,27 +79,32 @@ CompressionStream includes GenericTransformStream;
79
79
80
80
A {{CompressionStream}} has an associated <dfn for=CompressionStream>format</dfn> and <a>compression context</a><dfn for=CompressionStream>context</dfn>.
81
81
82
+
<div algorithm>
82
83
The <dfn constructor for=CompressionStream lt="CompressionStream(format)"><code>new CompressionStream(|format|)</code></dfn> steps are:
83
-
1. If *format* is unsupported in {{CompressionStream}}, then throw a {{TypeError}}.
84
-
1. Set [=this=]'s <a for=CompressionStream>format</a> to *format*.
85
-
1. Let *transformAlgorithm* be an algorithm which takes a *chunk* argument and runs the <a>compress and enqueue a chunk</a> algorithm with [=this=] and *chunk*.
86
-
1. Let *flushAlgorithm* be an algorithm which takes no argument and runs the <a>compress flush and enqueue</a> algorithm with [=this=].
84
+
1. If |format| is unsupported in {{CompressionStream}}, then throw a {{TypeError}}.
85
+
1. Set [=this=]'s <a for=CompressionStream>format</a> to |format|.
86
+
1. Let |transformAlgorithm| be an algorithm which takes a |chunk| argument and runs the <a>compress and enqueue a chunk</a> algorithm with [=this=] and |chunk|.
87
+
1. Let |flushAlgorithm| be an algorithm which takes no argument and runs the <a>compress flush and enqueue</a> algorithm with [=this=].
87
88
1. Set [=this=]'s [=GenericTransformStream/transform=] to a [=new=]{{TransformStream}}.
88
-
1. [=TransformStream/Set up=][=this=]'s [=GenericTransformStream/transform=] with <i>[=TransformStream/set up/transformAlgorithm=]</i> set to *transformAlgorithm* and <i>[=TransformStream/set up/flushAlgorithm=]</i> set to *flushAlgorithm*.
89
-
90
-
The <dfn>compress and enqueue a chunk</dfn> algorithm, given a {{CompressionStream}} object *cs* and a *chunk*, runs these steps:
91
-
1. If *chunk* is not a {{BufferSource}} type, then throw a {{TypeError}}.
92
-
1. Let *buffer* be the result of compressing *chunk* with *cs*'s <a for=CompressionStream>format</a> and <a for=CompressionStream>context</a>.
93
-
1. If *buffer* is empty, return.
94
-
1. Split *buffer* into one or more non-empty pieces and convert them into {{Uint8Array}}s.
95
-
1. For each {{Uint8Array}} *array*, [=TransformStream/enqueue=] *array* in *cs*'s [=GenericTransformStream/transform=].
89
+
1. [=TransformStream/Set up=][=this=]'s [=GenericTransformStream/transform=] with <i>[=TransformStream/set up/transformAlgorithm=]</i> set to |transformAlgorithm| and <i>[=TransformStream/set up/flushAlgorithm=]</i> set to |flushAlgorithm|.
90
+
</div>
96
91
97
-
The <dfn>compress flush and enqueue</dfn> algorithm, which handles the end of data from the input {{ReadableStream}} object, given a {{CompressionStream}} object *cs*, runs these steps:
92
+
<div algorithm>
93
+
The <dfn>compress and enqueue a chunk</dfn> algorithm, given a {{CompressionStream}} object |cs| and a |chunk|, runs these steps:
94
+
1. If |chunk| is not a {{BufferSource}} type, then throw a {{TypeError}}.
95
+
1. Let |buffer| be the result of compressing |chunk| with |cs|'s <a for=CompressionStream>format</a> and <a for=CompressionStream>context</a>.
96
+
1. If |buffer| is empty, return.
97
+
1. Split |buffer| into one or more non-empty pieces and convert them into {{Uint8Array}}s.
98
+
1. For each {{Uint8Array}} |array|, [=TransformStream/enqueue=] |array| in |cs|'s [=GenericTransformStream/transform=].
99
+
</div>
98
100
99
-
1. Let *buffer* be the result of compressing an empty input with *cs*'s <a for=CompressionStream>format</a> and <a for=CompressionStream>context</a>, with the finish flag.
100
-
1. If *buffer* is empty, return.
101
-
1. Split *buffer* into one or more non-empty pieces and convert them into {{Uint8Array}}s.
102
-
1. For each {{Uint8Array}} *array*, [=TransformStream/enqueue=] *array* in *cs*'s [=GenericTransformStream/transform=].
101
+
<div algorithm>
102
+
The <dfn>compress flush and enqueue</dfn> algorithm, which handles the end of data from the input {{ReadableStream}} object, given a {{CompressionStream}} object |cs|, runs these steps:
103
+
1. Let |buffer| be the result of compressing an empty input with |cs|'s <a for=CompressionStream>format</a> and <a for=CompressionStream>context</a>, with the finish flag.
104
+
1. If |buffer| is empty, return.
105
+
1. Split |buffer| into one or more non-empty pieces and convert them into {{Uint8Array}}s.
106
+
1. For each {{Uint8Array}} |array|, [=TransformStream/enqueue=] |array| in |cs|'s [=GenericTransformStream/transform=].
@@ -114,28 +119,33 @@ DecompressionStream includes GenericTransformStream;
114
119
115
120
A {{DecompressionStream}} has an associated <dfn for=DecompressionStream>format</dfn> and <a>compression context</a><dfn for=DecompressionStream>context</dfn>.
116
121
122
+
<div algorithm>
117
123
The <dfn constructor for=DecompressionStream lt="DecompressionStream(format)"><code>new DecompressionStream(|format|)</code></dfn> steps are:
118
-
1. If *format* is unsupported in {{DecompressionStream}}, then throw a {{TypeError}}.
119
-
1. Set [=this=]'s <a for=DecompressionStream>format</a> to *format*.
120
-
1. Let *transformAlgorithm* be an algorithm which takes a *chunk* argument and runs the <a>decompress and enqueue a chunk</a> algorithm with [=this=] and *chunk*.
121
-
1. Let *flushAlgorithm* be an algorithm which takes no argument and runs the <a>decompress flush and enqueue</a> algorithm with [=this=].
124
+
1. If |format| is unsupported in {{DecompressionStream}}, then throw a {{TypeError}}.
125
+
1. Set [=this=]'s <a for=DecompressionStream>format</a> to |format|.
126
+
1. Let |transformAlgorithm| be an algorithm which takes a |chunk| argument and runs the <a>decompress and enqueue a chunk</a> algorithm with [=this=] and |chunk|.
127
+
1. Let |flushAlgorithm| be an algorithm which takes no argument and runs the <a>decompress flush and enqueue</a> algorithm with [=this=].
122
128
1. Set [=this=]'s [=GenericTransformStream/transform=] to a [=new=]{{TransformStream}}.
123
-
1. [=TransformStream/Set up=][=this=]'s [=GenericTransformStream/transform=] with <i>[=TransformStream/set up/transformAlgorithm=]</i> set to *transformAlgorithm* and <i>[=TransformStream/set up/flushAlgorithm=]</i> set to *flushAlgorithm*.
124
-
125
-
The <dfn>decompress and enqueue a chunk</dfn> algorithm, given a {{DecompressionStream}} object *ds* and a *chunk*, runs these steps:
126
-
1. If *chunk* is not a {{BufferSource}} type, then throw a {{TypeError}}.
127
-
1. Let *buffer* be the result of decompressing *chunk* with *ds*'s <a for=DecompressionStream>format</a> and <a for=DecompressionStream>context</a>. If this results in an error, then throw a {{TypeError}}.
128
-
1. If *buffer* is empty, return.
129
-
1. Split *buffer* into one or more non-empty pieces and convert them into {{Uint8Array}}s.
130
-
1. For each {{Uint8Array}} *array*, [=TransformStream/enqueue=] *array* in *ds*'s [=GenericTransformStream/transform=].
129
+
1. [=TransformStream/Set up=][=this=]'s [=GenericTransformStream/transform=] with <i>[=TransformStream/set up/transformAlgorithm=]</i> set to |transformAlgorithm| and <i>[=TransformStream/set up/flushAlgorithm=]</i> set to |flushAlgorithm|.
130
+
</div>
131
131
132
-
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:
132
+
<div algorithm>
133
+
The <dfn>decompress and enqueue a chunk</dfn> algorithm, given a {{DecompressionStream}} object |ds| and a |chunk|, runs these steps:
134
+
1. If |chunk| is not a {{BufferSource}} type, then throw a {{TypeError}}.
135
+
1. Let |buffer| be the result of decompressing |chunk| with |ds|'s <a for=DecompressionStream>format</a> and <a for=DecompressionStream>context</a>. If this results in an error, then throw a {{TypeError}}.
136
+
1. If |buffer| is empty, return.
137
+
1. Split |buffer| into one or more non-empty pieces and convert them into {{Uint8Array}}s.
138
+
1. For each {{Uint8Array}} |array|, [=TransformStream/enqueue=] |array| in |ds|'s [=GenericTransformStream/transform=].
139
+
</div>
133
140
134
-
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.
141
+
<div algorithm>
142
+
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:
143
+
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.
135
144
1. If the end of the compressed input has not been reached, then throw a {{TypeError}}.
136
-
1. If *buffer* is empty, return.
137
-
1. Split *buffer* into one or more non-empty pieces and convert them into {{Uint8Array}}s.
138
-
1. For each {{Uint8Array}} *array*, [=TransformStream/enqueue=] *array* in *ds*'s [=GenericTransformStream/transform=].
145
+
1. If |buffer| is empty, return.
146
+
1. Split |buffer| into one or more non-empty pieces and convert them into {{Uint8Array}}s.
147
+
1. For each {{Uint8Array}} |array|, [=TransformStream/enqueue=] |array| in |ds|'s [=GenericTransformStream/transform=].
148
+
</div>
139
149
140
150
141
151
# Privacy and security considerations # {#privacy-security}
0 commit comments