Decompress data in the Mermaid compressed format in pure JavaScript, in the browser or Node 18+. No dependencies, no WebAssembly, about 7 KB gzipped, MIT licensed.
Mermaid streams appear in some Unreal Engine games, for example in Palworld save files. For reading Palworld saves end to end, see palworld-save-decoder, which uses this decoder. It powers the save reader in the Sourcemined Palworld IV calculator.
import { decompress } from 'mermaid-decompress';
const out = decompress(compressedBytes, uncompressedSize); // Uint8Arraydecompress(src: Uint8Array, size: number): Uint8Arraydecodes a raw Mermaid stream to exactlysizebytes.- Errors throw
MermaidError(code: "corrupt"); valid streams that use features this decoder does not implement (other codecs, tANS entropy, composite arrays, checksums) throwUnsupportedError(code: "unsupported"). - Every write is bounds-checked; damaged input ends in a clean error, never a hang or out-of-bounds write (fuzz-tested).
Speed: about 300 MB/s of output on Node 22 for real save files.
The decoder covers the Mermaid features produced at the default compression level. Streams compressed at high levels may use tANS entropy coding, which is not implemented yet and is reported as unsupported.
This is an independent implementation written from a format specification, without access to any existing decoder's source code. See CLEANROOM.md.
Oodle is a trademark of its owner. This project is not affiliated with or endorsed by RAD Game Tools or Epic Games.
MIT, see LICENSE.