# @wault/asset-packer

> Asset packing and optimization pipeline tools

Latest version **0.1.1** (published 2024-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wault/asset-packer
pnpm add @wault/asset-packer
yarn add @wault/asset-packer
bun add @wault/asset-packer
```

Provides the command `asset-packer`.

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2024-09-17 |
| First published | 2022-03-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.17.0 |
| Dependencies | 3 |
| Unpacked size | 78.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Wilhelm Vallrand |
| Maintainers | vallrand |

## Links

- npm: https://www.npmjs.com/package/@wault/asset-packer
- Repository: https://github.com/vallrand/asset-packer
- Homepage: https://github.com/vallrand/asset-packer#readme
- Issues: https://github.com/vallrand/asset-packer/issues
- npm.io page: https://npm.io/package/@wault/asset-packer

## Dependencies (3)

- [pngjs](https://npm.io/package/pngjs.md) ^6.0.0
- [jpeg-js](https://npm.io/package/jpeg-js.md) ^0.4.4
- [pngquant-bin](https://npm.io/package/pngquant-bin.md) ^6.0.0

## Recent versions

- 0.1.1 (latest) — 2024-09-17
- 0.1.0 — 2022-03-03

## README

# Asset Packer

[![Build](https://github.com/vallrand/asset-packer/workflows/publish/badge.svg)](https://github.com/vallrand/asset-packer/actions)
[![npm version](https://badge.fury.io/js/@wault%2Fasset-packer.svg)](https://www.npmjs.com/package/@wault/asset-packer)

> **WARNING**: This project is under development. Current use is not recommended!

Asset packing and optimization tools.

### Dependencies

Requires [Node](https://nodejs.org) ver10.17.0

 - [pngjs](https://github.com/lukeapage/pngjs)
 - [jpeg-js](https://github.com/eugeneware/jpeg-js)
 - [pngquant-bin](https://github.com/imagemin/pngquant-bin)
 
Note: `pngquant-bin` might require additional [dependencies](https://github.com/nodejs/node-gyp#option-1)

Linux:
```sh
$ sudo apt-get install libpng-dev
```
Windows:
```sh
$ npm install --global --production windows-build-tools
```
or download [manually](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)

## Installation

With [NPM](https://www.npmjs.com/)
```sh
$ npm install --save-dev @wault/asset-packer
```

### API
```javascript
import { processAssets } from '@wault/asset-packer'

processAssets([
    { filename: 'file.ext', buffer: Buffer.from() }
], {
    logger: true,
    base64: {
        prefix: '[hash]',
        filter: filename => !/\.(png|jpg)$/i.test(filename)
    },
    spritesheet: {
        prefix: '[hash]',
        trim: true,
        extrude: false,
        downscale: 1,
        group: {
            colors: 4,
            threshold: 4,
            diminish: 0,
            opaque: 0
        },
        pack: {
            maxWidth: 2048,
            maxHeight: 2048,
            padding: 0,
            border: 0,
            pow2: true,
            rotate: true
        }
    },
    encoder: {
        dithering: false,
        quality: 80,
    }
})
.then(files => {
    //write files
})
```

---
_Source: https://npm.io/package/@wault/asset-packer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
