A fast and small port of Zstandard to WASM.

Overview

Zstandard WASM

A fast and small port of Zstandard to WASM. (Decompress-only for now).

Features

  • Fast: Zstandard has been compiled with the -03 flag, so all optimizations are enabled and it will go pretty fast. Potentially in the future Zstandard could be recompiled with SIMD instructions too.
  • Small: the whole library weighs ~28kb min+gizpped, with no third-party dependencies other than Zstandard itself, which is bundled-in.
  • Up-to-date: starting from v1.5.0 of Zstandard this library aims to remain up to date with it, if you need version X of Zstandard install version X of zstandard-wasm.
  • Decompress-only: for now only a way to decompress zstd archives is exposed, potentially in the future a way to make zstd archives could be exposed too.
  • TypeScript-ready: the library is written in TypeScript so the exposed interface is clear.
  • Easy to use: using this module is easy, there's no need for a special bundler plugin and it works both in the browser and in Node.js.

Install

npm install --save zstandard-wasm

Usage

import fs from 'fs';
import zstd from 'zstandard-wasm'; // Default entrypoint, optimized for speed, ~28kb min+gzip
// import zstd from 'zstandard-wasm/speed'; // Default entrypoint, optimized for speed, ~28kb min+gzip
// import zstd from 'zstandard-wasm/size'; // Alternative entrypoint, optimized for bundle size, ~22kb min+gzip

await zstd.loadWASM (); // First of all you need to load the WASM instance and wait for it

const compressed = fs.readFileSync ( 'something.zst' ); // You get a Buffer or Uint8Array to decompress
const decompressed = zstd.decompress ( compressed ); // You get a Uint8Array containing the decompressed data

Limitations

  • This library doesn't support streaming decompression (yet?), so in order for it to decompress an archive you have to make sure that either the archive itself contains some metadata about the size of the uncompressed archive or you pass the decompress function the appropriate size number manually. This isn't a problem in practice if you just make archives via a simple zstd -9 file.txt or something, but if you are doing something fancier than that you might want to check that this library is actually able to decompress your files before shipping them.

Licenses

Owner
Fabio Spampinato
Full-stack developer passionate about open source and empowering people.
Fabio Spampinato
the ares multi-system console emulation suite

ares ares is a multi-system emulator that began development on October 14th, 2004. It is a descendent of higan and bsnes, and focuses on accuracy and

higan 40 Jul 21, 2021
Open source release of challenges and other code used in the Hack-A-Sat 2 Qualifier in 2021.

Hack-a-Sat 2 Qualifier This repository contains the open source release for the Hack-a-Sat 2 qualifier from 2021. Released artifacts include: Source c

Cromulence 10 Jul 19, 2021
GFX Demo for the ESP-IDF

Display Drivers and Demo for GFX This is a Demo of GFX With Several Display Drivers This is not GFX itself, but it includes it. GFX Documentation is b

honey the codewitch 24 Jul 16, 2021
Stuff I've made/found for reversing/modding/extracting NieR:Replicant v1.224...

NieR:Replicant ver.1.22474487139 Tools Archive (.arc) Files Hex Signature: 28 B5 2F FD Can contain one or multiple compressed files. Files are compres

Woeful_Wolf 5 Jul 17, 2021
Powerful automated tool for reverse engineering Unity IL2CPP binaries

Powerful automated tool for reverse engineering Unity IL2CPP binaries

Katy 1.3k Jul 23, 2021
DUHOME AIOT platform based on du1906 and esp32

1. Example of ESP32-Korvo-DU1906 board This example shows how to use ESP32-Korvo-DU1906 board working with DuHome AIOT Voice Platform (度家-AIOT语音平台).Th

Baidu 9 Jul 15, 2021
C++11 port of docopt

docopt.cpp: A C++11 Port Contents docopt creates beautiful command-line interfaces Isn't it awesome how getopt (and boost::program_options for you fan

null 899 Jul 8, 2021
A programming environment for Lua for the Raspberry Pi Pico microcontroller

picolua A programming environment for Lua for the Raspberry Pi Pico microcontroller. Version 0.3, April 2021 What is this? picolua is a proof-of-conce

Kevin Boone 23 Jul 26, 2021
Tails is a fast, minimal Forth-like interpreter core in C++ with no assembly

Tails is a minimal, fast Forth-like interpreter core. It uses no assembly code, only C++, but an elegant tail-recursion technique inspired by Wasm3 makes it nearly as efficient as hand-written assembly. I created it as a one-day hack to celebrate May Forth 2021 … then kept going because it's fun.

Jens Alfke 55 Jul 22, 2021
"Zero setup" cross-compilation for a wide variety of architectures.

"Zero setup" cross-compilation for a wide variety of architectures. xcross includes compact docker images and a build utility for minimal setup C/C++ cross-compiling, inspired by rust-embedded/cross

Alexander Huszagh 18 Jul 22, 2021
Simple Dynamic Strings library for C

Simple Dynamic Strings Notes about version 2: this is an updated version of SDS in an attempt to finally unify Redis, Disque, Hiredis, and the stand a

Salvatore Sanfilippo 3.6k Jul 17, 2021
null 94 Jul 23, 2021
Raspberry Pi Pico Arduino core, for all RP2040 boards

Arduino-Pico Raspberry Pi Pico Arduino core, for all RP2040 boards This is a port of the RP2040 (Raspberry Pi Pico processor) to the Arduino ecosystem

Earle F. Philhower, III 224 Jul 21, 2021
Simple Stepper Motor Analyzer

A DYI stepper motor analyzer. This is a new design that is based on Raspberry Pi Pico and users a compact single PCB design. NOTE: The legacy STM32 based stepper analyzer was moved to this repository https://github.com/zapta/legacy_stepper_motor_analyzer.

Zapta 20 Jul 26, 2021