Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/awcross/is-font
Detect if a file is a font
https://github.com/awcross/is-font
Last synced: about 11 hours ago
JSON representation
Detect if a file is a font
- Host: GitHub
- URL: https://github.com/awcross/is-font
- Owner: awcross
- License: mit
- Created: 2016-08-02T23:25:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-28T19:01:58.000Z (almost 8 years ago)
- Last Synced: 2024-10-31T11:58:37.984Z (19 days ago)
- Language: JavaScript
- Homepage:
- Size: 418 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# is-font [![Build Status](https://travis-ci.org/awcross/is-font.svg?branch=master)](https://travis-ci.org/awcross/is-font) [![Coverage Status](https://coveralls.io/repos/github/awcross/is-font/badge.svg?branch=master)](https://coveralls.io/github/awcross/is-font?branch=master)
> Detect if a file is a font
## Install
```
$ npm install --save is-font
```## Usage
```js
const isFont = require('is-font');isFont('awesome.woff2');
//=> {ext: woff2, mime: application/font-woff}isFont('fake.ttf');
//=> false
```## API
### isFont(filepath)
Returns an object if true. False otherwise.
#### filepath
Type: `string`
Path to the file.
## Supported file types
- [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType)
- [`otf`](https://en.wikipedia.org/wiki/OpenType)
- [`ttf`](https://en.wikipedia.org/wiki/TrueType)
- [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format)
- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format)## Related
- [is-font-cli](https://github.com/awcross/is-font-cli) - CLI for this module
## License
MIT © [Alex Cross](http://alexcross.io)