Socket
Socket
Sign inDemoInstall

@thewtex/zstddec

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

dist/zstddec.cjs

14

package.json
{
"name": "@thewtex/zstddec",
"version": "0.1.0",
"version": "0.1.1",
"description": "ZSTD (Zstandard) decoder for Web and Node.js, using WebAssembly",
"repository": "github:donmccurdy/zstddec",
"main": "dist/zstddec.js",
"type": "module",
"exports": {
"types": "dist/zstddec.d.ts",
"require": "./dist/zstddec.cjs",
"default": "./dist/zstddec.modern.js"
},
"main": "dist/zstddec.cjs",
"module": "dist/zstddec.modern.js",

@@ -14,4 +20,4 @@ "source": "zstddec.ts",

"test": "npm run test:node && npm run test:browser",
"test:node": "tape *.test.js | tap-spec",
"test:browser": "browserify *.test.js | tape-run | tap-spec",
"test:node": "tape *.test.cjs | tap-spec",
"test:browser": "browserify *.test.cjs | tape-run | tap-spec",
"preversion": "npm run dist && npm run test",

@@ -18,0 +24,0 @@ "postversion": "git push && git push --tags && npm publish"

@@ -51,3 +51,24 @@ # zstddec

./combine.sh -r ../../lib -o zstddeclib.c zstddeclib-in.c
emcc zstddeclib.c -Oz -s EXPORTED_FUNCTIONS="['_ZSTD_decompress', '_ZSTD_findDecompressedSize', '_ZSTD_isError', '_malloc', '_free']" -Wl,--no-entry -s STANDALONE_WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s MALLOC=emmalloc -o zstddec.wasm
```
Add the following to the end of *zstddeclib.c* to [shim out unused wasi
imports](https://github.com/emscripten-core/emscripten/issues/17331),
```c
int __wasi_fd_write(int, int, int, int) {
__builtin_trap();
}
int __wasi_fd_seek(int, int64_t, int, int) {
__builtin_trap();
}
int __wasi_fd_close(int) {
__builtin_trap();
}
_Noreturn void __wasi_proc_exit(int) {
__builtin_trap();
}
```
```shell
emcc zstddeclib.c -Oz -s EXPORTED_FUNCTIONS="['_ZSTD_decompress', '_ZSTD_findDecompressedSize', '_ZSTD_isError', '_malloc', '_free']" -Wl,--no-entry -s ALLOW_MEMORY_GROWTH=1 -s MALLOC=emmalloc -o zstddec.wasm
base64 -w 0 zstddec.wasm > zstddec.txt

@@ -54,0 +75,0 @@ ```

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc