Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"packageManager": "pnpm@7.17.0",
"dependencies": {
"bson": "^4.7.2",
"byte-base64": "^1.1.0",
"js-base64": "^3.7.5",
"lodash.clonedeep": "^4.5.0",
"lz4js": "^0.2.0"
},
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/parse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EJSON } from 'bson';
import { base64ToBytes } from 'byte-base64';
import { Base64 } from 'js-base64';
import { decompress } from 'lz4js';

export type ParseTypeGuardFunction<T> = (obj: any) => obj is T;
Expand Down Expand Up @@ -165,7 +165,7 @@ function unminifyKeys(
export function decompressString(str: string): string {
try {
return new TextDecoder().decode(
Uint8Array.from(decompress(base64ToBytes(str)))
Uint8Array.from(decompress(Base64.toUint8Array(str)))
);
} catch (err: unknown) {
// str is not a base64 encoded string of a byte array
Expand Down
6 changes: 4 additions & 2 deletions src/stringify.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EJSON } from 'bson';
import { bytesToBase64 } from 'byte-base64';
import { Base64 } from 'js-base64';
import cloneDeep from 'lodash.clonedeep';
import { compress } from 'lz4js';
import {
Expand Down Expand Up @@ -251,5 +251,7 @@ function minifyKeys(
}

export function compressString(str: string): string {
return bytesToBase64(compress(new TextEncoder().encode(str)));
return Base64.fromUint8Array(
compress(new TextEncoder().encode(str)) as Uint8Array
);
}