0.1.0 • Published 6 years ago

sfnt2woff-zopfli v0.1.0

Weekly downloads
4
License
MPL-1.1 AND GPL-2...
Repository
github
Last release
6 years ago

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.

ParamTypeDescription
dataBufferWOFF 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.

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