font-query is a Node.js package for querying the fonts available on your system and returning their names and paths.
Current version support Windows and Linux
npm install font-query
Alternatively, if you wish to use font-query as a command-line tool:
npm install -g font-query
const {fontQuery} = require('font-query');
let myFont = fontQuery('Bal');
console.log(myFont);
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
[
[
'Baloo (TrueType)',
'C:\\Users\\omen\\AppData\\Local\\Microsoft\\Windows\\Fonts\\Baloo-Regular.ttf'
]
]
MIT License - Copyright 2021 Salvatore Santagati (mailto:me@salsan.dev)