Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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) //
```