Skip to content

Latest commit

 

History

History
65 lines (45 loc) · 1.62 KB

README.md

File metadata and controls

65 lines (45 loc) · 1.62 KB

Font Query

font-query is a Node.js package for querying the fonts available on your system and returning their names and paths.

Socket Badge NPM Version NPM Install Size NPM Downloads License

Current version support Windows and Linux

Install

npm install font-query

Alternatively, if you wish to use font-query as a command-line tool:

npm install -g font-query

Usage

Synchronous

const {fontQuery} = require('font-query');

let myFont = fontQuery('Bal');

console.log(myFont);

Asynchronous

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'
      ]
  ]

License

MIT License - Copyright 2021 Salvatore Santagati (mailto:[email protected])