# @icon-magic/imagemin-farm

> Icon magic image minification farm.

Latest version **2.4.1-beta.0** (published 2021-10-12) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install @icon-magic/imagemin-farm
pnpm add @icon-magic/imagemin-farm
yarn add @icon-magic/imagemin-farm
bun add @icon-magic/imagemin-farm
```

## 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 | 2.4.1-beta.0 |
| Published | 2021-10-12 |
| First published | 2018-11-24 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 83.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Adam Miller |
| Maintainers | thegilby, camario25, epicmiller, rchitloor, omayeli |

## Links

- npm: https://www.npmjs.com/package/@icon-magic/imagemin-farm
- npm.io page: https://npm.io/package/@icon-magic/imagemin-farm

## Dependencies (6)

- [imagemin](https://npm.io/package/imagemin.md) ^7.0.0
- [imagemin-advpng](https://npm.io/package/imagemin-advpng.md) ^6.0.0
- [imagemin-zopfli](https://npm.io/package/imagemin-zopfli.md) ^7.0.0
- [imagemin-optipng](https://npm.io/package/imagemin-optipng.md) ^8.0.0
- [imagemin-pngcrush](https://npm.io/package/imagemin-pngcrush.md) ^6.0.0
- [@icon-magic/logger](https://npm.io/package/@icon-magic/logger.md) ^2.3.0-beta.0

## Recent versions

- 2.4.1-beta.0 (latest) — 2021-10-12
- 2.7.0-beta.0 (beta) — 2021-12-22
- 2.5.0-beta.0 — 2021-11-03
- 2.4.0-beta.0 — 2021-10-08
- 2.3.0-beta.0 — 2021-07-27
- 2.2.8-beta.0 — 2021-05-04
- 2.2.0-beta.0 — 2019-09-16
- 2.1.0-beta.0 — 2019-08-15
- 2.0.2-beta.0 — 2019-08-15
- 2.0.1-beta.0 — 2019-07-31
- 0.0.2 — 2018-11-24
- 0.0.1 — 2018-11-24

## README

# @icon-magic/imagemin-farm

A process farm for image minification! Has two main methods exported:

## minify(path: string): Promise\<Result>

Given a path to a `png`, `jpg`, or `webp` file, minify the file. File will be modified in-place and replaced with the minified version of the file. Spins up `os.cpus() - 1` child processes to minify files. Minification tasks are transparently load balanced between processes. Promise will resolve with a `Result` object of the shape:

```typescript
interface Result {
  path: 'path-to-file';
  worker: number; // Worker PID of completed task;
  status: {
    // Status across all tasks
    total: number; // Total tasks
    remaining: number; // Remaining tasks
    progress: number; // Task progress between 0 and 1.
    workers: [
      {
        pid: number; // Worker PID
        total: number; // Total tasks for worker
        remaining: number; // Remaining tasks for worker
        progress: number | null; // Task progress of worker between 0 and 1
      }
      // repeats for number of workers...
    ];
  };
}
```

## subscribe(func: (res: ProcessStatus) => void): void

Subscribe a listener to recieve regular updates on process status. Good for updating progress bars. Recieves the `status` property of the `Results` object (defined above).

---
_Source: https://npm.io/package/@icon-magic/imagemin-farm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
