Nodejs module for installing system fonts. This module is not tightly coupled to any specific font libraries or apis. It also is not opinionated about how you get the fonts on your machine.
- Mac OS
- Windows
- Ubuntu 14.0.4.1 LTS
Run as Admin on linux or OSX
###Assumptions
- Assumes font file(s) are downloaded to your machine, but not yet installed.
Open your command line and run npm install installfont
Installing a single font file
var installfont = require('installfont');
installfont('path/to/your/font.ttf', function(err) {
if(err) console.log(err, err.stack);
//handle callback tasks here
});
Installing all font files within a specified directory
var installfont = require('installfont');
installfont('path/to/dir/containing/fonts', function(err) {
if(err) console.log(err, err.stack);
//handle callback tasks here
});
Pass installfont an options parameter as a third argument
var installfont = require('installfont');
var options = {
removeFonts: true
};
installfont('path/to/dir/containing/fonts', function(err) {
if(err) console.log(err, err.stack);
//handle callback tasks here
}, options);
removeFonts
- Pass true or false to specify if you want your font file(s) to be deleted after they are installed. Defaults to false;