Oxipng image encoder in WebAssembly
npm install @wasm-codecs/oxipng@wasm-codecs/oxipng   > Oxipng WebAssembly Codec
1. Installation
1. Usage
1. API
1. Examples
1. License
``bash`
npm install @wasm-codecs/oxipng
Requirements:
- Node.js 10 or later
`typescript
import encode from '@wasm-codecs/oxipng';
(async () => {
const encodedImage = await encode(image, encodeOptions);
})();
`
Returns a buffer containing the compressed image data.
##### image: Buffer
Buffer of a PNG image.
##### encodeOptions?: EncodeOptions
All encoding options are optional and fall back to the default values.
`typescript`
type EncodeOptions = {
level?: number;
}
`typescript
import fs from 'fs';
import encode from '@wasm-codecs/oxipng';
// read input image as a buffer
const data = fs.readFileSync('in.png');
// encode the image using @wasm-codecs/oxipng
const output = encode(data);
// save the image to the file system
fs.writeFileSync('out.png', output);
``
Licensed under the MIT license.
© Copyright Cyril Wanner