New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fontverter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fontverter

Convert font buffers between TTF/WOFF/WOFF2

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.7K
decreased by-11.62%
Maintainers
1
Weekly downloads
 
Created
Source

fontverter

Convert Buffer instances back and forth between SFNT (TrueType/OpenType), WOFF, and WOFF2 formats.

Uses the WebAssembly-based wawoff2 and woff2sfnt-sfnt2woff modules under the hood, so no binaries or native modules are involved.

const fontverter = require('fontverter');

const mySfntFontBuffer = Buffer.from(/*...*/);
const myWoffFontBuffer = await fontverter.convert(mySfntFontBuffer, 'woff');
const myWoff2FontBuffer = await fontverter.convert(myWoffFontBuffer, 'woff2');

API

fontverter.convert(buffer, toFormat[, fromFormat]): Promise<Buffer>

Asynchronously convert a Buffer instance containing a font to another format.

toFormat and fromFormat can be either 'sfnt', 'woff', or 'woff2'.

If fromFormat is omitted, the source format will be detected based on the signature at the start of the buffer.

For backwards compatibility reasons, 'truetype' is supported as an alias for 'sfnt' in both toFormat and fromFormat.

Returns a promise that fulfills with the converted font as a Buffer instance, or rejected with an error. If toFormat is the same as the current format (as specified by fromFormat or detected), the original buffer instance will be returned without any conversion taking place.

fontverter.detectFormat(buffer): String

Returns the detected format of the font contained in buffer (either 'sfnt', 'woff', or 'woff2'), or throws an exception if the format could not be detected.

Releases

Changelog

License

3-clause BSD license -- see the LICENSE file for details.

Keywords

FAQs

Package last updated on 19 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc