JSPM

@wasm-codecs/oxipng

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4278
  • Score
    100M100P100Q134464F
  • License MIT

Oxipng image encoder in WebAssembly

Package Exports

  • @wasm-codecs/oxipng

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@wasm-codecs/oxipng) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@wasm-codecs/oxipng npm version license downloads

Oxipng WebAssembly Codec

Table of contents

  1. Installation
  2. Usage
  3. API
  4. Examples
  5. License

Installation

npm install @wasm-codecs/oxipng

Requirements:

  • Node.js 10 or later

Usage

import encode from '@wasm-codecs/oxipng';

(async () => {
  const encodedImage = await encode(image, encodeOptions);
})();

API

encode(image, encodeOptions?): Buffer

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.

type EncodeOptions = {
  level?: number;
}

Examples

Using Node.js

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);

License

Licensed under the MIT license.

© Copyright Cyril Wanner