Socket
Socket
Sign inDemoInstall

is-woff

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-woff

Check if a Buffer/Uint8Array is WOFF


Version published
Weekly downloads
5.3K
decreased by-3.52%
Maintainers
1
Install size
3.92 kB
Created
Weekly downloads
 

Readme

Source

is-woff Build Status

Check if a Buffer/Uint8Array is a WOFF

Install

$ npm install --save is-woff

Usage

Node.js
var readChunk = require('read-chunk'); // npm install read-chunk
var isWoff = require('is-woff');
var buffer = readChunk.sync('font.woff', 0, 8);

isWoff(buffer);
//=> true
Browser
var xhr = new XMLHttpRequest();
xhr.open('GET', 'font.woff');
xhr.responseType = 'arraybuffer';

xhr.onload = function () {
	isWoff(new Uint8Array(this.response));
	//=> true
};

xhr.send();

API

isWoff(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 8 bytes.

Test

$ npm test

test file from Font-Awesome

License

MIT © junmer

Keywords

FAQs

Last updated on 29 Feb 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc