Socket
Socket
Sign inDemoInstall

@thewtex/zstddec

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thewtex/zstddec - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

dist/zstddec.esm.js

29

package.json
{
"name": "@thewtex/zstddec",
"version": "0.1.2",
"version": "0.2.0",
"description": "ZSTD (Zstandard) decoder for Web and Node.js, using WebAssembly",
"repository": "github:thewtex/zstddec-wasm",
"repository": "github:donmccurdy/zstddec",
"type": "module",
"sideEffects": false,
"type": "module",
"source": "zstddec.ts",
"types": "./dist/zstddec.d.ts",
"main": "./dist/zstddec.cjs",
"module": "./dist/zstddec.esm.js",
"exports": {
"types": "dist/zstddec.d.ts",
"types": "./dist/zstddec.d.ts",
"require": "./dist/zstddec.cjs",
"default": "./dist/zstddec.modern.js"
},
"main": "dist/zstddec.cjs",
"module": "dist/zstddec.modern.js",
"source": "zstddec.ts",
"types": "dist/zstddec.d.ts",
"scripts": {
"dist": "microbundle --format modern,cjs",
"watch": "microbundle watch --format modern,cjs",
"dist": "microbundle --format modern,esm,cjs --no-compress",
"watch": "microbundle watch --format modern,esm,cjs --no-compress",
"test": "npm run test:node && npm run test:browser",
"test:node": "tape *.test.cjs | tap-spec",
"test:browser": "browserify *.test.cjs | tape-run | tap-spec",
"preversion": "npm run dist && npm run test",
"preversion": "rimraf dist/* && npm run dist && npm run test",
"postversion": "git push && git push --tags && npm publish"

@@ -33,7 +35,8 @@ },

"devDependencies": {
"browserify": "^16.5.1",
"browserify": "^17.0.0",
"microbundle": "^0.15.1",
"rimraf": "^5.0.5",
"tap-spec": "^5.0.0",
"tape": "^5.0.1",
"tape-run": "^10.0.0"
"tape": "^5.7.0",
"tape-run": "^11.0.0"
},

@@ -40,0 +43,0 @@ "files": [

@@ -5,3 +5,3 @@ # zstddec

[![Minzipped size](https://badgen.net/bundlephobia/minzip/zstddec)](https://bundlephobia.com/result?p=zstddec)
[![Build Status](https://github.com/donmccurdy/zstddec/workflows/build/badge.svg?branch=master&event=push)](https://github.com/donmccurdy/zstddec/actions?query=workflow%3Abuild)
[![Build Status](https://github.com/donmccurdy/zstddec/workflows/build/badge.svg?branch=main&event=push)](https://github.com/donmccurdy/zstddec/actions?query=workflow%3Abuild)

@@ -51,28 +51,17 @@ [ZSTD (Zstandard)](https://github.com/facebook/zstd) decoder for Web and Node.js, using WebAssembly.

```shell
./combine.sh -r ../../lib -o zstddeclib.c zstddeclib-in.c
./create_single_file_decoder.sh
```
Add the following to the end of *zstddeclib.c* to [shim out unused wasi
imports](https://github.com/emscripten-core/emscripten/issues/17331),
> **Note**
The current build is based on zstd v1.5.0. The binary sized increased
following this version.
```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
emcc zstddeclib.c -s EXPORTED_FUNCTIONS="['_ZSTD_decompress', '_ZSTD_findDecompressedSize', '_ZSTD_isError', '_malloc', '_free']" -Wl,--no-entry -s WASM=1 -Oz -g0 -flto -s ALLOW_MEMORY_GROWTH=1 -s FILESYSTEM=0 -s STANDALONE_WASM=1 -DNDEBUG=1 -s PURE_WASI=0 -o zstddec.wasm
base64 -w 0 zstddec.wasm > zstddec.txt
```
> **Note**
The `-w 0` argument is only for the `base64` shipped on Linux systems -- on macOS this should be omitted.
The base64 string written to `zstddec.txt` is embedded as the `wasm` variable at the bottom

@@ -79,0 +68,0 @@ of the source file. The rest of the file is written by hand, in order to avoid an additional JS

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc