Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vutran/os-fonts
Retrieve fonts available on your OS.
https://github.com/vutran/os-fonts
font javascript node os
Last synced: 29 days ago
JSON representation
Retrieve fonts available on your OS.
- Host: GitHub
- URL: https://github.com/vutran/os-fonts
- Owner: vutran
- License: mit
- Created: 2016-08-24T03:27:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-31T05:13:27.000Z (almost 4 years ago)
- Last Synced: 2024-12-11T00:57:02.449Z (about 2 months ago)
- Topics: font, javascript, node, os
- Language: JavaScript
- Size: 94.7 KB
- Stars: 14
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# os-fonts
[![Travis](https://img.shields.io/travis/vutran/os-fonts/master.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/vutran/os-fonts) [![Coveralls branch](https://img.shields.io/coveralls/vutran/os-fonts/master.svg?maxAge=2592000&style=flat-square)](https://coveralls.io/github/vutran/os-fonts) [![license](https://img.shields.io/github/license/vutran/os-fonts.svg?maxAge=2592000&style=flat-square)](LICENSE)
> Retrieve fonts available on your OS.
## Install
```bash
$ npm install --save os-fonts
```## Usage
```js
const osFonts = require('os-fonts');osFonts.getAll().then(fonts => {
// array of fonts...
fonts.forEach(font => {
console.log(font);
});
})
```## API
### getAll([useType])
Returns a `Promise` with all paths to all fonts.
#### useType
Type: `String`
Default: `system`
Options: `user`, `local`, `network`, `system`
The use type.
### getAllSync([useType])
Returns paths to all fonts (synchronous version of `getAll`).
### getFontsInDirectory(dir)
Returns a `Promise` with paths to all fonts in the given directory.
#### dir
Type: `String`
The directory to read
### getFontsInDirectory(dir)
Returns paths to all fonts in the given directory (synchronous version of `getFontsInDirectory`).
## License
MIT © [Vu Tran](https://github.com/vutran/)