
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
installfont-electron
Advanced tools
Update method to electron apps to execute from an ASAR file which doesn't allow temp files inside it.
Added options.overrideLocalFileDir
This property is to a temp folder to extract and install fonts from. It must be from outside be a folder outside the application's runtime directory.
Example:
let osTemp = require('os').tmpdir();
installFont(fullPath, function(err) {
if (err) {
console.error('unable to install font', err);
reject(err);
} else {
console.log('installed font', fullPath);
resolve();
}
}, {overrideLocalFileDir: osTemp});
Must be unpacked from asar add to your config:
"build": {
"appId": "YOURID",
"win": {
"target": "NSIS",
"asar": true,
"asarUnpack": [
" ./node_reports",
"./assets/fonts",
"./node_modules/installfont-electron",
""
]
},
"publish": {
"provider": "generic",
"url": "http://127.0.0.1"
}
}
}
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.
Run as Admin on linux or OSX
###Assumptions
Open your command line and run npm install installfont-electron
Installing a single font file
var installfont = require('installfont-electron');
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-electron');
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-electron');
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;
FAQs
Super easy nodejs system font installation
We found that installfont-electron demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.