Skip to content

Commit

Permalink
Swap brotli dependency (#123)
Browse files Browse the repository at this point in the history
Per @ MaTiAtSIE via
#120 (comment)

Switch from the older, non-maintained
[wasm-brotli](https://github.com/dfrankland/wasm-brotli) to the newer
and maintained
[brotli-wasm](https://github.com/httptoolkit/brotli-wasm).

Drop in swap, all tests still pass.

Closes #120
  • Loading branch information
wilwade authored Mar 14, 2024
1 parent 3de7eea commit 5db9db4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions lib/compression.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import zlib from 'zlib'
import snappy from 'snappyjs'
import { compress as brotliCompress, decompress as brotliDecompress } from 'wasm-brotli'
import { compress as brotliCompress, decompress as brotliDecompress } from 'brotli-wasm'

type d_identity = (value: ArrayBuffer | Buffer | Uint8Array ) => ArrayBuffer | Buffer | Uint8Array
type d_gzip = (value: ArrayBuffer | Buffer | string ) => Buffer
Expand Down Expand Up @@ -64,7 +64,7 @@ async function deflate_brotli(value: Uint8Array) {
lgwin: 22
}
*/)

return Buffer.from(compressedContent);
}

Expand Down Expand Up @@ -103,4 +103,4 @@ function buffer_from_result(result: ArrayBuffer | Buffer | Uint8Array): Buffer {
} else {
return Buffer.from(result);
}
}
}
22 changes: 11 additions & 11 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@types/long": "^4.0.2",
"@types/node-int64": "^0.4.29",
"@types/thrift": "^0.10.11",
"brotli-wasm": "^2.0.1",
"browserify-zlib": "^0.2.0",
"bson": "4.6.3",
"cross-fetch": "^3.1.4",
Expand All @@ -27,7 +28,6 @@
"snappyjs": "^0.6.1",
"thrift": "0.16.0",
"varint": "^6.0.0",
"wasm-brotli": "^2.0.2",
"xxhash-wasm": "^1.0.2"
},
"devDependencies": {
Expand Down

0 comments on commit 5db9db4

Please sign in to comment.