1
- ## Zlib
1
+ # Zlib
2
2
3
3
You can access this module with:
4
4
@@ -8,7 +8,7 @@ This provides bindings to Gzip/Gunzip, Deflate/Inflate, and
8
8
DeflateRaw/InflateRaw classes. Each class takes the same options, and
9
9
is a readable/writable Stream.
10
10
11
- ### Examples
11
+ ## Examples
12
12
13
13
Compressing or decompressing a file can be done by piping an
14
14
fs.ReadStream into a zlib stream, then into an fs.WriteStream.
@@ -101,109 +101,115 @@ tradeoffs involved in zlib usage.
101
101
}
102
102
}).listen(1337);
103
103
104
- ### Constants
104
+ ## Constants
105
+
106
+ <!-- type=misc-->
105
107
106
108
All of the constants defined in zlib.h are also defined on
107
109
` require('zlib') ` . They are described in more detail in the zlib
108
110
documentation. See < http://zlib.net/manual.html#Constants >
109
111
for more details.
110
112
111
- ### zlib.createGzip([ options] )
113
+ ## zlib.createGzip([ options] )
112
114
113
115
Returns a new [ Gzip] ( #zlib.Gzip ) object with an [ options] ( #options ) .
114
116
115
- ### zlib.createGunzip([ options] )
117
+ ## zlib.createGunzip([ options] )
116
118
117
119
Returns a new [ Gunzip] ( #zlib.Gunzip ) object with an [ options] ( #options ) .
118
120
119
- ### zlib.createDeflate([ options] )
121
+ ## zlib.createDeflate([ options] )
120
122
121
123
Returns a new [ Deflate] ( #zlib.Deflate ) object with an [ options] ( #options ) .
122
124
123
- ### zlib.createInflate([ options] )
125
+ ## zlib.createInflate([ options] )
124
126
125
127
Returns a new [ Inflate] ( #zlib.Inflate ) object with an [ options] ( #options ) .
126
128
127
- ### zlib.createDeflateRaw([ options] )
129
+ ## zlib.createDeflateRaw([ options] )
128
130
129
131
Returns a new [ DeflateRaw] ( #zlib.DeflateRaw ) object with an [ options] ( #options ) .
130
132
131
- ### zlib.createInflateRaw([ options] )
133
+ ## zlib.createInflateRaw([ options] )
132
134
133
135
Returns a new [ InflateRaw] ( #zlib.InflateRaw ) object with an [ options] ( #options ) .
134
136
135
- ### zlib.createUnzip([ options] )
137
+ ## zlib.createUnzip([ options] )
136
138
137
139
Returns a new [ Unzip] ( #zlib.Unzip ) object with an [ options] ( #options ) .
138
140
139
141
140
- ### zlib.Gzip
142
+ ## Class: zlib.Gzip
141
143
142
144
Compress data using gzip.
143
145
144
- ### zlib.Gunzip
146
+ ## Class: zlib.Gunzip
145
147
146
148
Decompress a gzip stream.
147
149
148
- ### zlib.Deflate
150
+ ## Class: zlib.Deflate
149
151
150
152
Compress data using deflate.
151
153
152
- ### zlib.Inflate
154
+ ## Class: zlib.Inflate
153
155
154
156
Decompress a deflate stream.
155
157
156
- ### zlib.DeflateRaw
158
+ ## Class: zlib.DeflateRaw
157
159
158
160
Compress data using deflate, and do not append a zlib header.
159
161
160
- ### zlib.InflateRaw
162
+ ## Class: zlib.InflateRaw
161
163
162
164
Decompress a raw deflate stream.
163
165
164
- ### zlib.Unzip
166
+ ## Class: zlib.Unzip
165
167
166
168
Decompress either a Gzip- or Deflate-compressed stream by auto-detecting
167
169
the header.
168
170
169
171
## Convenience Methods
170
172
173
+ <!-- type=misc-->
174
+
171
175
All of these take a string or buffer as the first argument, and call the
172
176
supplied callback with ` callback(error, result) ` . The
173
177
compression/decompression engine is created using the default settings
174
178
in all convenience methods. To supply different options, use the
175
179
zlib classes directly.
176
180
177
- ### zlib.deflate(buf, callback)
181
+ ## zlib.deflate(buf, callback)
178
182
179
183
Compress a string with Deflate.
180
184
181
- ### zlib.deflateRaw(buf, callback)
185
+ ## zlib.deflateRaw(buf, callback)
182
186
183
187
Compress a string with DeflateRaw.
184
188
185
- ### zlib.gzip(buf, callback)
189
+ ## zlib.gzip(buf, callback)
186
190
187
191
Compress a string with Gzip.
188
192
189
- ### zlib.gunzip(buf, callback)
193
+ ## zlib.gunzip(buf, callback)
190
194
191
195
Decompress a raw Buffer with Gunzip.
192
196
193
- ### zlib.inflate(buf, callback)
197
+ ## zlib.inflate(buf, callback)
194
198
195
199
Decompress a raw Buffer with Inflate.
196
200
197
- ### zlib.inflateRaw(buf, callback)
201
+ ## zlib.inflateRaw(buf, callback)
198
202
199
203
Decompress a raw Buffer with InflateRaw.
200
204
201
- ### zlib.unzip(buf, callback)
205
+ ## zlib.unzip(buf, callback)
202
206
203
207
Decompress a raw Buffer with Unzip.
204
208
205
209
## Options
206
210
211
+ <!-- type=misc-->
212
+
207
213
Each class takes an options object. All options are optional. (The
208
214
convenience methods use the default settings for all options.)
209
215
@@ -219,7 +225,9 @@ relevant when compressing, and are ignored by the decompression classes.
219
225
See the description of ` deflateInit2 ` and ` inflateInit2 ` at
220
226
< http://zlib.net/manual.html#Advanced > for more information on these.
221
227
222
- ### Memory Usage Tuning
228
+ ## Memory Usage Tuning
229
+
230
+ <!-- type=misc-->
223
231
224
232
From ` zlib/zconf.h ` , modified to node's usage:
225
233
0 commit comments