
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
@4bitlabs/codecs
Advanced tools
@4bitlabs/codecs
A collection of decoders (and eventually encoders) for working with Sierra On-line SCI-engine assets.
Name | Decoder | Encoder |
---|---|---|
Huffman | ✅ | |
Lempel–Ziv–Welch | ✅ |
Decoding bytes with Huffman:
import { Huffman } from '@4bitlabs/codecs';
const encodedBytes = Uint8Array.of(/* encoded data */);
const bytes = Huffman.decode(encodedBytes);
Decoding bytes with Lempel-Ziv-Welch:
import { Lzw } from '@4bitlabs/codecs';
const encodedBytes = Uint8Array.of(/* encoded data */);
const bytes = Lzw.decode(encodedBytes);
By default, most-significant bit ordering is used. You can change the encoded byte ordering of the decoder with the options
parameter. To use least-significant bit
ordering:
const bytes = Lzw.decode(encodedBytes, { order: 'lsb' });
The default code-width it uses is 8
, this can also be adjusted. To use a 7-bit code width:
const bytes = Lzw.decode(encodedBytes, { literalWidth: 7 });
Also, an entirely custom LZW dictionaries can be used for decoding:
import { Lzw } from '@4bitlabs/codecs';
const dictionary = [
Lzw.EOF_MARKER,
0x41, // A
0x42, // B
0x43, // C
0x44, // D
];
const bytes = Lzw.decode(encodedBytes, { dictionary });
Longer codings can be encoded in the dictionary by using either an array of numbers of with a Uint8Array
:
import { Lzw, EOF_MARKER } from '@4bitlabs/codecs';
const dictionary = [
Lzw.EOF_MARKER,
Uint8Array.of(0x47, 0x41, 0x54, 0x41), // GATA
Uint8Array.of(0x41, 0x54, 0x54, 0x41), // ATTA
Uint8Array.of(0x43, 0x47, 0x41, 0x54), // CGAT
Uint8Array.of(0x41, 0x43, 0x41, 0x47), // ACAG
];
const bytes = Lzw.decode(encodedBytes, { dictionary });
FAQs
A collection of codecs for working with SCI-engine assets
The npm package @4bitlabs/codecs receives a total of 11 weekly downloads. As such, @4bitlabs/codecs popularity was classified as not popular.
We found that @4bitlabs/codecs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.