{"id":15312316,"url":"https://github.com/donmccurdy/zstddec-wasm","last_synced_at":"2025-11-13T22:55:47.993Z","repository":{"id":40811052,"uuid":"282793581","full_name":"donmccurdy/zstddec-wasm","owner":"donmccurdy","description":"ZSTD (Zstandard) decoder for Web and Node.js, using WebAssembly.","archived":false,"fork":false,"pushed_at":"2023-10-28T04:38:58.000Z","size":532,"stargazers_count":59,"open_issues_count":6,"forks_count":11,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-15T01:14:17.950Z","etag":null,"topics":["compression","webassembly","zstandard","zstd"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/donmccurdy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["donmccurdy"]}},"created_at":"2020-07-27T04:27:03.000Z","updated_at":"2025-04-11T18:14:33.000Z","dependencies_parsed_at":"2023-02-10T12:40:13.352Z","dependency_job_id":"d547f027-77cd-4c6a-a8a1-0bc65c967d36","html_url":"https://github.com/donmccurdy/zstddec-wasm","commit_stats":null,"previous_names":["donmccurdy/zstddec"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donmccurdy%2Fzstddec-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donmccurdy%2Fzstddec-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donmccurdy%2Fzstddec-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donmccurdy%2Fzstddec-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donmccurdy","download_url":"https://codeload.github.com/donmccurdy/zstddec-wasm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986316,"owners_count":21194025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compression","webassembly","zstandard","zstd"],"created_at":"2024-10-01T08:36:31.769Z","updated_at":"2025-11-13T22:55:47.988Z","avatar_url":"https://github.com/donmccurdy.png","language":"TypeScript","funding_links":["https://github.com/sponsors/donmccurdy"],"categories":[],"sub_categories":[],"readme":"# zstddec\n\n[![Latest NPM release](https://img.shields.io/npm/v/zstddec.svg)](https://www.npmjs.com/package/zstddec)\n[![Minzipped size](https://badgen.net/bundlephobia/minzip/zstddec)](https://bundlephobia.com/result?p=zstddec)\n[![Build Status](https://github.com/donmccurdy/zstddec/workflows/build/badge.svg?branch=main\u0026event=push)](https://github.com/donmccurdy/zstddec/actions?query=workflow%3Abuild)\n\n[ZSTD (Zstandard)](https://github.com/facebook/zstd) decoder for Web and Node.js, using WebAssembly.\n\n## Installation\n\n```shell\nnpm install --save zstddec\n```\n\n## API\n\n```javascript\nimport { ZSTDDecoder } from 'zstddec';\n\nconst decoder = new ZSTDDecoder();\n\nawait decoder.init();\n\nconst decompressedArray = decoder.decode( compressedArray, uncompressedSize );\n```\n\n\u003e **Limitations:** The decoder may fail with the error `wasm function signature contains illegal type` when the `uncompressedSize` is not known in advance and given to the `decode()` method. This is presumably a bug in the WASM bindings, which I am not yet sure how to fix.\n\n## Contributing\n\nTo build the project locally, run:\n\n```\nyarn install\nyarn build\n```\n\nTo test changes:\n\n```\nyarn test\n```\n\n## Building from source\n\nCompiled from https://github.com/facebook/zstd/tree/dev/build/single_file_libs, with the\nfollowing steps:\n\n```shell\n# build zstd\nmake\ncd build/single_file_libs\n./create_single_file_decoder.sh\n\n# build wasm\nemcc 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\n\n# build streaming wasm\nemcc zstddeclib.c -s EXPORTED_FUNCTIONS=\"['_ZSTD_decompress', '_ZSTD_findDecompressedSize', '_ZSTD_createDCtx', '_ZSTD_decompressStream', '_ZSTD_freeDCtx', '_ZSTD_DStreamInSize', '_ZSTD_DStreamOutSize', '_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-stream.wasm\n\n# encode WASM to base64\nbase64 -i zstddec.wasm \u003e zstddec.txt\nbase64 -i zstddec-stream.wasm \u003e zstddec-stream.txt\n```\n\nThe base64 string written to `zstddec.txt` is embedded as the `wasm` variable at the bottom\nof the source file. The rest of the file is written by hand, in order to avoid an additional JS\nwrapper generated by Emscripten.\n\n_Last built June 2025, zstd v1.5.7 (`f8745da6`), emscc v4.0.10_.\n\n## License\n\nJavaScript wrapper is provided under the MIT License, and the WASM ZSTD decoder is provided by Facebook under the BSD 3-Clause License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonmccurdy%2Fzstddec-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonmccurdy%2Fzstddec-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonmccurdy%2Fzstddec-wasm/lists"}