diff --git a/TODO.md b/TODO.md index a3b84b0..abe69b5 100644 --- a/TODO.md +++ b/TODO.md @@ -39,3 +39,4 @@ about inventory change - ❌ afterDestructionTickers shouldn't exist... destruction should be deferred - ❌ Remove position pack check from trait and add to Vector +- ❌ zLib dictionary for packet compression diff --git a/packages/core/flate.js b/packages/core/flate.js new file mode 100644 index 0000000..9ff314a --- /dev/null +++ b/packages/core/flate.js @@ -0,0 +1,11 @@ +import {deflateSync, inflateSync} from 'zlib'; + +export function inflate(buffer) { + return inflateSync(buffer); +} + +export function deflate(buffer) { + return deflateSync(buffer, { + level: 9, + }); +} diff --git a/packages/core/index.js b/packages/core/index.js index af271ff..4c5f159 100644 --- a/packages/core/index.js +++ b/packages/core/index.js @@ -120,4 +120,5 @@ export { mergeDiffPrimitive, } from './merge-diff'; export {fastApply} from './fast-apply'; +export {inflate, deflate} from './flate'; export {PropertyMixin as Property} from './property';