# oxipng-node

> Nodejs wrapper for multithreaded PNG optimizer written in Rust

Latest version **1.1.1** (published 2021-04-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install oxipng-node
pnpm add oxipng-node
yarn add oxipng-node
bun add oxipng-node
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2021-04-12 |
| First published | 2021-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 2 |
| Author | Saionaro |
| Maintainers | saionaro |
| Keywords | png, compress, optimize, oxipng |

## Links

- npm: https://www.npmjs.com/package/oxipng-node
- Repository: https://github.com/Saionaro/oxipng-node
- Homepage: https://github.com/Saionaro/oxipng-node#readme
- Issues: https://github.com/Saionaro/oxipng-node/issues
- npm.io page: https://npm.io/package/oxipng-node

## Dependencies (1)

- [bin-wrapper](https://npm.io/package/bin-wrapper.md) ^4.1.0

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2021-04-12
- 1.1.0 — 2021-04-12
- 1.0.0 — 2021-04-12

## README

# oxipng-node [![CI](https://github.com/Saionaro/oxipng-node/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Saionaro/oxipng-node/actions/workflows/ci.yml) [![npm version](https://badge.fury.io/js/oxipng-node.svg)](https://badge.fury.io/js/oxipng-node)

Nodejs wrapper for multithreaded PNG optimizer written in Rust: [oxipng](https://github.com/shssoichiro/oxipng)

## Installation

Execute command

`npm i oxipng-node` or `yarn add oxipng-node`

depending on your project package manager.

## Usage

```javascript
// import module
const { run } = require("oxipng-node");
// import { run } from "oxipng-node"; // in case of TS

async function optimizeCat() {
  try {
    await run({
      input: "/Users/user/project/images/cat.png",
      out: "/Users/user/project/images/optimized/cat.png",
      optimization: 2,
    });

    console.log("File optimized!");
  } catch (e) {
    console.error(e);
  }

  // you can also use it without async-await
  // run(options).then(() => { ... }).catch(e => { ... })
}
```

## TypeScript Support

Package includes type definitions out the box.

## Options

| Name            | Type            | Default value | Description                                                                             |
| --------------- | --------------- | ------------- | --------------------------------------------------------------------------------------- |
| `path`          | `string`        | -             | Global path to file for optimization supports GLOBs                                     |
| `out`           | `string`        | -             | Global path to output file, if missing will modify original file inplace                |
| `optimization?` | `number` (1-6)  | 2             | Optimization preset see [here](https://github.com/shssoichiro/oxipng#usage) for details |
| `alpha?`        | `boolean`       | false         | Perform additional alpha optimizations                                                  |
| `interlacing?`  | `boolean`       | false         | PNG interlace type                                                                      |
| `strip?`        | `"safe", "all"` | -             | Strip metadata                                                                          |

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