Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/salsan/font-query
font-query is a Node.js package for query the fonts available on your system.
https://github.com/salsan/font-query
font fonts linux nodejs npm-package query windows
Last synced: 2 months ago
JSON representation
font-query is a Node.js package for query the fonts available on your system.
- Host: GitHub
- URL: https://github.com/salsan/font-query
- Owner: salsan
- License: mit
- Created: 2021-07-31T14:44:11.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-03T07:29:15.000Z (7 months ago)
- Last Synced: 2024-10-11T18:49:46.531Z (3 months ago)
- Topics: font, fonts, linux, nodejs, npm-package, query, windows
- Language: JavaScript
- Homepage:
- Size: 365 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Font Query](https://github.com/salsan/font-query/assets/111319/a38b8b80-68fd-4768-82be-00f113e774f9)
font-query is a Node.js package for querying the fonts available on your system and returning their names and paths.
[![Socket Badge](https://socket.dev/api/badge/npm/package/font-query)](https://socket.dev/npm/package/font-query)
[![NPM Version](https://img.shields.io/npm/v/font-query.svg)](https://www.npmjs.com/package/font-query)
[![NPM Install Size](https://packagephobia.com/badge?p=font-query)](https://packagephobia.com/result?p=font-query)
[![NPM Downloads](https://img.shields.io/npm/dt/font-query.svg)](https://www.npmjs.com/package/font-query)
[![License](https://img.shields.io/github/license/salsan/font-query.svg)](https://opensource.org/licenses/MIT)Current version support **Windows** and **Linux**
## Install
```bash
npm install font-query
```Alternatively, if you wish to use font-query as a command-line tool:
```bash
npm install -g font-query
```## Usage
### **Synchronous**
```js
const {fontQuery} = require('font-query');let myFont = fontQuery('Bal');
console.log(myFont);
```
### **Asynchronous**
```js
const {fontQueryAsync} = require('font-query');let myFont = fontQueryAsync('Bal');
myFont.then(fonts => {
console.log(fonts)
})
.catch(err => {
console.log(err)
})```
The return value of fonts is an array with the name and relative path of the query request```bash
[
[
'Baloo (TrueType)',
'C:\\Users\\omen\\AppData\\Local\\Microsoft\\Windows\\Fonts\\Baloo-Regular.ttf'
]
]
```
# LicenseMIT License - Copyright 2021 Salvatore Santagati ()