Skip to content

Latest commit

 

History

History
77 lines (52 loc) · 2.01 KB

README.md

File metadata and controls

77 lines (52 loc) · 2.01 KB

node-sfnt2woff-zopfli

This is just a Node.js wrapper around bramstein's sfnt2woff-zopfli utility.

In respect for his work this wrapper is also MPL/GPL/LGPL licensed, but note that the Zopfli implementation is licensed under the Apache License.

Usage

If you're using npm:

npm install --save-dev sfnt2woff-zopfli

Alternatively you can clone this repo and run npm install. Be sure to get the submodule dependency (use the --recursive flag when cloning). Note that you can't install directly from this repo because npm doesn't understand submodules.

API Reference

woff : object

Kind: global namespace

woff.decode ⇒ Buffer

Convert WOFF data to TTF.

Kind: static property of woff
Returns: Buffer - Decoded TTF data.

Param Type Description
data Buffer WOFF font data to be decoded.

Example

var woff = require('sfnt2woff-zopfli');
var input = fs.readFileSync('something.woff');
var output = 'output.ttf';
fs.writeFileSync(output, woff.decode(input));

woff.encode ⇒ Buffer

Convert TTF data to WOFF.

Kind: static property of woff
Returns: Buffer - Encoded WOFF data.

Param Type Description
data Buffer TTF font data to be encoded.

Example

var woff = require('sfnt2woff-zopfli');
var input = fs.readFileSync('something.ttf');
var output = 'output.woff';
fs.writeFileSync(output, woff.encode(input));