Packer (#172)
* introduce pako and add general packer interface * add tests for packer * use function API instead of class API for better tree shaking support * refcatoring the rollup bundle config
This commit is contained in:
10
src/packer/pack.ts
Normal file
10
src/packer/pack.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { deflate } from 'pako/dist/pako_deflate';
|
||||
import { PackFn, MARK, eventWithTimeAndPacker } from './base';
|
||||
|
||||
export const pack: PackFn = (event) => {
|
||||
const _e: eventWithTimeAndPacker = {
|
||||
...event,
|
||||
v: MARK,
|
||||
};
|
||||
return deflate(JSON.stringify(_e), { to: 'string' });
|
||||
};
|
||||
Reference in New Issue
Block a user