Update to fflate (#448)
* Update to fflate * Update docs, bundler config
This commit is contained in:
12
src/declarations/pako/index.d.ts
vendored
12
src/declarations/pako/index.d.ts
vendored
@@ -1,12 +0,0 @@
|
||||
declare module 'pako/dist/pako_deflate' {
|
||||
export const deflate: any;
|
||||
}
|
||||
|
||||
declare module 'pako/dist/pako_inflate' {
|
||||
export const inflate: any;
|
||||
}
|
||||
|
||||
declare module 'pako' {
|
||||
export const deflate: any;
|
||||
export const inflate: any;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { deflate } from 'pako/dist/pako_deflate';
|
||||
import { strFromU8, strToU8, zlibSync } from 'fflate';
|
||||
import { PackFn, MARK, eventWithTimeAndPacker } from './base';
|
||||
|
||||
export const pack: PackFn = (event) => {
|
||||
@@ -6,5 +6,5 @@ export const pack: PackFn = (event) => {
|
||||
...event,
|
||||
v: MARK,
|
||||
};
|
||||
return deflate(JSON.stringify(_e), { to: 'string' });
|
||||
return strFromU8(zlibSync(strToU8(JSON.stringify(_e))), true);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { inflate } from 'pako/dist/pako_inflate';
|
||||
import { strFromU8, strToU8, unzlibSync } from 'fflate';
|
||||
import { UnpackFn, eventWithTimeAndPacker, MARK } from './base';
|
||||
import { eventWithTime } from '../types';
|
||||
|
||||
@@ -16,7 +16,7 @@ export const unpack: UnpackFn = (raw: string) => {
|
||||
}
|
||||
try {
|
||||
const e: eventWithTimeAndPacker = JSON.parse(
|
||||
inflate(raw, { to: 'string' }),
|
||||
strFromU8(unzlibSync(strToU8(raw, true)))
|
||||
);
|
||||
if (e.v === MARK) {
|
||||
return e;
|
||||
|
||||
Reference in New Issue
Block a user