Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fiahfy/packbits
PackBits implementation in JavaScript.
https://github.com/fiahfy/packbits
encoding packbits
Last synced: about 1 month ago
JSON representation
PackBits implementation in JavaScript.
- Host: GitHub
- URL: https://github.com/fiahfy/packbits
- Owner: fiahfy
- License: mit
- Created: 2018-09-26T13:13:41.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:58:36.000Z (almost 2 years ago)
- Last Synced: 2024-04-24T13:27:49.814Z (8 months ago)
- Topics: encoding, packbits
- Language: TypeScript
- Homepage:
- Size: 1.16 MB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# packbits
![badge](https://github.com/fiahfy/packbits/workflows/Node.js%20Package/badge.svg)
> [PackBits](https://en.wikipedia.org/wiki/PackBits) implementation in JavaScript.
## Installation
```bash
npm install @fiahfy/packbits
```## Usage
### Default
#### Encoding
```js
import { encode } from '@fiahfy/packbits'console.log(buf) //
const encoded = encode(buf)
console.log(encoded) //
```#### Decoding
```js
import { decode } from '@fiahfy/packbits'console.log(buf) //
const decoded = decode(buf)
console.log(decoded) //
```### ICNS format
In [Apple Icon Image format](https://en.wikipedia.org/wiki/Apple_Icon_Image_format), pixel data are often compressed (per channel) with a format similar to PackBits.
#### Encoding
```js
import { encode } from '@fiahfy/packbits'console.log(buf) //
const encoded = encode(buf, { format: 'icns' })
console.log(encoded) //
```#### Decoding
```js
import { decode } from '@fiahfy/packbits'console.log(buf) //
const decoded = decode(buf, { format: 'icns' })
console.log(decoded) //
```