mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-10 22:00:58 +01:00
parent
505e36d9f0
commit
4e8ff8e74a
3 changed files with 11 additions and 32 deletions
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Removed binary strings and `Array` support.
|
- Removed binary strings and `Array` support.
|
||||||
- Removed fallbacks for unsupported TypedArray methods (`.set()`, `.subarray()`).
|
- Removed fallbacks for unsupported TypedArray methods (`.set()`, `.subarray()`).
|
||||||
- Removed support of `Inflate` & `Deflate` instance create without `new`.
|
- Removed support of `Inflate` & `Deflate` instance create without `new`.
|
||||||
|
- Removed `Z_SYNC_FLUSH` related code from wrappers (buggy and no tests).
|
||||||
- Switched to es6. Legacy es5 builds available in `/dist`.
|
- Switched to es6. Legacy es5 builds available in `/dist`.
|
||||||
- Structure of `/dist` folder changed.
|
- Structure of `/dist` folder changed.
|
||||||
- Upgraded build tools to modern ones.
|
- Upgraded build tools to modern ones.
|
||||||
|
|
|
@ -14,7 +14,7 @@ const toString = Object.prototype.toString;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Z_NO_FLUSH, Z_FINISH,
|
Z_NO_FLUSH, Z_FINISH,
|
||||||
Z_OK, Z_STREAM_END, Z_SYNC_FLUSH,
|
Z_OK, Z_STREAM_END,
|
||||||
Z_DEFAULT_COMPRESSION,
|
Z_DEFAULT_COMPRESSION,
|
||||||
Z_DEFAULT_STRATEGY,
|
Z_DEFAULT_STRATEGY,
|
||||||
Z_DEFLATED
|
Z_DEFLATED
|
||||||
|
@ -42,9 +42,7 @@ const {
|
||||||
*
|
*
|
||||||
* Compressed result, generated by default [[Deflate#onData]]
|
* Compressed result, generated by default [[Deflate#onData]]
|
||||||
* and [[Deflate#onEnd]] handlers. Filled after you push last chunk
|
* and [[Deflate#onEnd]] handlers. Filled after you push last chunk
|
||||||
* (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you
|
* (call [[Deflate#push]] with `Z_FINISH` / `true` param).
|
||||||
* push a chunk with explicit flush (call [[Deflate#push]] with
|
|
||||||
* `Z_SYNC_FLUSH` param).
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,8 +185,7 @@ function Deflate(options) {
|
||||||
* Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
|
* Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
|
||||||
* new compressed chunks. Returns `true` on success. The last data block must have
|
* new compressed chunks. Returns `true` on success. The last data block must have
|
||||||
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
|
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
|
||||||
* [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you
|
* [[Deflate#onEnd]].
|
||||||
* can use mode Z_SYNC_FLUSH, keeping the compression context.
|
|
||||||
*
|
*
|
||||||
* On fail call [[Deflate#onEnd]] with error code and return false.
|
* On fail call [[Deflate#onEnd]] with error code and return false.
|
||||||
*
|
*
|
||||||
|
@ -238,7 +235,7 @@ Deflate.prototype.push = function (data, mode) {
|
||||||
this.ended = true;
|
this.ended = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {
|
if (strm.avail_out === 0 || (strm.avail_in === 0 && _mode === Z_FINISH)) {
|
||||||
this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));
|
this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));
|
||||||
}
|
}
|
||||||
} while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);
|
} while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);
|
||||||
|
@ -251,13 +248,6 @@ Deflate.prototype.push = function (data, mode) {
|
||||||
return status === Z_OK;
|
return status === Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// callback interim results if Z_SYNC_FLUSH.
|
|
||||||
if (_mode === Z_SYNC_FLUSH) {
|
|
||||||
this.onEnd(Z_OK);
|
|
||||||
strm.avail_out = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -280,8 +270,7 @@ Deflate.prototype.onData = function (chunk) {
|
||||||
* other if not.
|
* other if not.
|
||||||
*
|
*
|
||||||
* Called once after you tell deflate that the input stream is
|
* Called once after you tell deflate that the input stream is
|
||||||
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
|
* complete (Z_FINISH). By default - join collected chunks,
|
||||||
* or if an error happened. By default - join collected chunks,
|
|
||||||
* free memory and fill `results` / `err` properties.
|
* free memory and fill `results` / `err` properties.
|
||||||
**/
|
**/
|
||||||
Deflate.prototype.onEnd = function (status) {
|
Deflate.prototype.onEnd = function (status) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ const toString = Object.prototype.toString;
|
||||||
/* ===========================================================================*/
|
/* ===========================================================================*/
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
|
Z_NO_FLUSH, Z_FINISH,
|
||||||
Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_BUF_ERROR
|
Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_BUF_ERROR
|
||||||
} = require('./zlib/constants');
|
} = require('./zlib/constants');
|
||||||
|
|
||||||
|
@ -40,9 +40,7 @@ const {
|
||||||
*
|
*
|
||||||
* Uncompressed result, generated by default [[Inflate#onData]]
|
* Uncompressed result, generated by default [[Inflate#onData]]
|
||||||
* and [[Inflate#onEnd]] handlers. Filled after you push last chunk
|
* and [[Inflate#onEnd]] handlers. Filled after you push last chunk
|
||||||
* (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
|
* (call [[Inflate#push]] with `Z_FINISH` / `true` param).
|
||||||
* push a chunk with explicit flush (call [[Inflate#push]] with
|
|
||||||
* `Z_SYNC_FLUSH` param).
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -179,8 +177,7 @@ function Inflate(options) {
|
||||||
* Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
|
* Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
|
||||||
* new output chunks. Returns `true` on success. The last data block must have
|
* new output chunks. Returns `true` on success. The last data block must have
|
||||||
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
|
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
|
||||||
* [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
|
* [[Inflate#onEnd]].
|
||||||
* can use mode Z_SYNC_FLUSH, keeping the decompression context.
|
|
||||||
*
|
*
|
||||||
* On fail call [[Inflate#onEnd]] with error code and return false.
|
* On fail call [[Inflate#onEnd]] with error code and return false.
|
||||||
*
|
*
|
||||||
|
@ -244,7 +241,7 @@ Inflate.prototype.push = function (data, mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strm.next_out) {
|
if (strm.next_out) {
|
||||||
if (strm.avail_out === 0 || status === Z_STREAM_END || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {
|
if (strm.avail_out === 0 || status === Z_STREAM_END || (strm.avail_in === 0 && _mode === Z_FINISH)) {
|
||||||
|
|
||||||
if (this.options.to === 'string') {
|
if (this.options.to === 'string') {
|
||||||
|
|
||||||
|
@ -291,13 +288,6 @@ Inflate.prototype.push = function (data, mode) {
|
||||||
return status === Z_OK;
|
return status === Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// callback interim results if Z_SYNC_FLUSH.
|
|
||||||
if (_mode === Z_SYNC_FLUSH) {
|
|
||||||
this.onEnd(Z_OK);
|
|
||||||
strm.avail_out = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -321,8 +311,7 @@ Inflate.prototype.onData = function (chunk) {
|
||||||
* other if not.
|
* other if not.
|
||||||
*
|
*
|
||||||
* Called either after you tell inflate that the input stream is
|
* Called either after you tell inflate that the input stream is
|
||||||
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
|
* complete (Z_FINISH). By default - join collected chunks,
|
||||||
* or if an error happened. By default - join collected chunks,
|
|
||||||
* free memory and fill `results` / `err` properties.
|
* free memory and fill `results` / `err` properties.
|
||||||
**/
|
**/
|
||||||
Inflate.prototype.onEnd = function (status) {
|
Inflate.prototype.onEnd = function (status) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue