mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-18 10:53:49 +01:00
Doc fixes & minor polish
This commit is contained in:
parent
9f495b8b13
commit
6cb53e5b51
5 changed files with 27 additions and 17 deletions
|
@ -96,11 +96,13 @@ var output = inflator.result;
|
||||||
Notes
|
Notes
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Pako does not contains some very specific zlib functions.
|
Pako does not contains some specific zlib functions:
|
||||||
|
|
||||||
- __deflate__ - writing bustom gzip headers and methods `deflateSetDictionary`,
|
- __deflate__ - writing custom gzip headers and methods `deflateSetDictionary`,
|
||||||
`deflateParams`, `deflateSetHeader`, `deflateBound`, `deflatePending`.
|
`deflateParams`, `deflateSetHeader`, `deflateBound`, `deflatePending`.
|
||||||
- __inflate__ - TBD.
|
- __inflate__ - getting custom gzip headers and methods `inflateGetDictionary`,
|
||||||
|
`inflateGetHeader`, `inflateSetDictionary`, `inflateSync`, `inflateSyncPoint`,
|
||||||
|
`inflateCopy`, `inflateUndermine`, `inflateMark`.
|
||||||
|
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
|
|
|
@ -244,7 +244,7 @@ Deflate.prototype.onEnd = function(status) {
|
||||||
}
|
}
|
||||||
this.chunks = [];
|
this.chunks = [];
|
||||||
this.err = status;
|
this.err = status;
|
||||||
this.msg = msg[status];
|
this.msg = this.strm.msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ function deflate(input, options) {
|
||||||
deflator.push(input, true);
|
deflator.push(input, true);
|
||||||
|
|
||||||
// That will never happens, if you don't cheat with options :)
|
// That will never happens, if you don't cheat with options :)
|
||||||
if (deflator.err) { throw msg[deflator.err]; }
|
if (deflator.err) { throw deflator.msg; }
|
||||||
|
|
||||||
return deflator.result;
|
return deflator.result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,9 @@ var zstream = require('./zlib/zstream');
|
||||||
* - `chunkSize` - size of generated data chunks (16K by default)
|
* - `chunkSize` - size of generated data chunks (16K by default)
|
||||||
* - `raw` (boolean) - do raw inflate
|
* - `raw` (boolean) - do raw inflate
|
||||||
*
|
*
|
||||||
|
* By default, when no options set, autodetect deflate/gzip data format via
|
||||||
|
* wrapper header.
|
||||||
|
*
|
||||||
* ##### Example:
|
* ##### Example:
|
||||||
*
|
*
|
||||||
* ```javascript
|
* ```javascript
|
||||||
|
@ -87,8 +90,8 @@ var Inflate = function(options) {
|
||||||
|
|
||||||
var opt = this.options;
|
var opt = this.options;
|
||||||
|
|
||||||
// check `raw` if `windowBits` NOT defined directly,
|
// Force window size for `raw` data, if not set directly,
|
||||||
// or we will get bug because of autodetect
|
// because we have no header for autodetect.
|
||||||
if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {
|
if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {
|
||||||
opt.windowBits = -opt.windowBits;
|
opt.windowBits = -opt.windowBits;
|
||||||
if (opt.windowBits === 0) { opt.windowBits = -15; }
|
if (opt.windowBits === 0) { opt.windowBits = -15; }
|
||||||
|
@ -228,7 +231,7 @@ Inflate.prototype.onEnd = function(status) {
|
||||||
}
|
}
|
||||||
this.chunks = [];
|
this.chunks = [];
|
||||||
this.err = status;
|
this.err = status;
|
||||||
this.msg = msg[status];
|
this.msg = this.strm.msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,14 +240,22 @@ Inflate.prototype.onEnd = function(status) {
|
||||||
* - data (Uint8Array|Array): input data to compress.
|
* - data (Uint8Array|Array): input data to compress.
|
||||||
* - options (Object): zlib inflate options.
|
* - options (Object): zlib inflate options.
|
||||||
*
|
*
|
||||||
* Decompress `data` with inflate alrorythm and `options`.
|
* Decompress `data` with inflate/ungzip and `options`. Autodetect
|
||||||
|
* format via wrapper header by default. That's why we don't provide
|
||||||
|
* separate `ungzip` method.
|
||||||
*
|
*
|
||||||
* Supported options are:
|
* Supported options are:
|
||||||
*
|
*
|
||||||
* - windowBits
|
* - windowBits
|
||||||
*
|
*
|
||||||
* [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
|
* [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
|
||||||
* for more information on these.
|
* for more information.
|
||||||
|
*
|
||||||
|
* Sugar (options):
|
||||||
|
*
|
||||||
|
* - raw (Boolean) - say that we work with raw stream, if you don't wish to specify
|
||||||
|
* negative windowBits implicitly.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* ##### Example:
|
* ##### Example:
|
||||||
*
|
*
|
||||||
|
@ -266,7 +277,7 @@ function inflate(input, options) {
|
||||||
inflator.push(input, true);
|
inflator.push(input, true);
|
||||||
|
|
||||||
// That will never happens, if you don't cheat with options :)
|
// That will never happens, if you don't cheat with options :)
|
||||||
if (inflator.err) { throw msg[inflator.err]+':'+inflator.strm.msg; }
|
if (inflator.err) { throw inflator.msg; }
|
||||||
|
|
||||||
return inflator.result;
|
return inflator.result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,9 +103,9 @@ var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */
|
||||||
|
|
||||||
var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
|
var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
|
||||||
|
|
||||||
function err(strm, error) {
|
function err(strm, errorCode) {
|
||||||
strm.msg = msg[error];
|
strm.msg = msg[errorCode];
|
||||||
return error;
|
return errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function rank(f) {
|
function rank(f) {
|
||||||
|
|
|
@ -25,9 +25,6 @@ describe('Inflate defaults', function () {
|
||||||
|
|
||||||
|
|
||||||
describe('Inflate ungzip', function () {
|
describe('Inflate ungzip', function () {
|
||||||
// TODO: Investigate, why ungzip does not autodetect window size and
|
|
||||||
// require to set windowBits directly
|
|
||||||
|
|
||||||
it('with autodetect', function(done) {
|
it('with autodetect', function(done) {
|
||||||
testInflate(samples, {}, { gzip: true }, done);
|
testInflate(samples, {}, { gzip: true }, done);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue