@@ -102,10 +102,10 @@ http.createServer((request, response) => {
102
102
103
103
// Note: This is not a conformant accept-encoding parser.
104
104
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3
105
- if (acceptEncoding . match ( / \b deflate\b / )) {
105
+ if (/ \b deflate\b / . test (acceptEncoding )) {
106
106
response .writeHead (200 , { ' Content-Encoding' : ' deflate' });
107
107
raw .pipe (zlib .createDeflate ()).pipe (response);
108
- } else if (acceptEncoding . match ( / \b gzip\b / )) {
108
+ } else if (/ \b gzip\b / . test (acceptEncoding )) {
109
109
response .writeHead (200 , { ' Content-Encoding' : ' gzip' });
110
110
raw .pipe (zlib .createGzip ()).pipe (response);
111
111
} else {
@@ -119,15 +119,15 @@ By default, the `zlib` methods will throw an error when decompressing
119
119
truncated data. However, if it is known that the data is incomplete, or
120
120
the desire is to inspect only the beginning of a compressed file, it is
121
121
possible to suppress the default error handling by changing the flushing
122
- method that is used to compressed the last chunk of input data:
122
+ method that is used to decompress the last chunk of input data:
123
123
124
124
``` js
125
125
// This is a truncated version of the buffer from the above examples
126
126
const buffer = Buffer .from (' eJzT0yMA' , ' base64' );
127
127
128
128
zlib .unzip (
129
129
buffer,
130
- {finishFlush: zlib .constants .Z_SYNC_FLUSH },
130
+ { finishFlush: zlib .constants .Z_SYNC_FLUSH },
131
131
(err , buffer ) => {
132
132
if (! err) {
133
133
console .log (buffer .toString ());
0 commit comments