# @node-libraries/wasm-avif-encoder

> WebAssembly avif encoder with WebWorker support.

Latest version **1.0.2** (published 2025-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @node-libraries/wasm-avif-encoder
pnpm add @node-libraries/wasm-avif-encoder
yarn add @node-libraries/wasm-avif-encoder
bun add @node-libraries/wasm-avif-encoder
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2025-02-07 |
| First published | 2024-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | SoraKumo |
| Maintainers | sora_kumo |
| Keywords | avif, encode, wasm, worker, WebAssembly, WebWorker |

## Links

- npm: https://www.npmjs.com/package/@node-libraries/wasm-avif-encoder
- Repository: https://github.com/node-libraries/wasm-avif-encoder
- Homepage: https://github.com/node-libraries/wasm-avif-encoder#readme
- Issues: https://github.com/node-libraries/wasm-avif-encoder/issues
- npm.io page: https://npm.io/package/@node-libraries/wasm-avif-encoder

## Dependencies (1)

- [worker-lib](https://npm.io/package/worker-lib.md) ^1.0.1

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2025-02-07
- 1.0.1 — 2024-02-28
- 1.0.0 — 2024-02-16

## README

# @node-libraries/wasm-avif-encoder

# Overview

Provides the ability to encode WebP using WebAssembly and WebWorker.

Remix(esbuild) and Next.js(webpack) are supported.

# types

```ts
encode(params:{data: BufferSource, width: number, height: number, quality?: number}): Promise<Uint8Array | null>
```

```ts
encode(params:{data: ImageData, quality?: number}): Promise<Uint8Array | null>
```

# usage

```ts
import { encode } from '@node-libraries/wasm-avif-encoder';

// Next.js(webpack)
const encodedValue = await encode({ data: ctx.getImageData(0, 0, img.width, img.height) });
const encodedValue2 = await encode({ data: arrayBuffer, width, height });

// Remix(esbuild)
// Files need to be installed manually
// node_modules/@node-libraries/wasm-webp-encoder/dist  =>
//   public/avif/worker.js
//   public/avif/avif.js
//   public/avif/avif.wasm
const encodedValue3 = await encode({ data: arrayBuffer, width, height, worker: '/avif/worker.js' });
```

# Sample when used with Next.js

- https://github.com/SoraKumo001/next-webp

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