Comparing version 0.4.0 to 0.4.1
20
index.js
@@ -1,4 +0,5 @@ | ||
const recursive = require('recursive-readdir'); | ||
const path = require('path'); | ||
const os = require('os'); | ||
const recursive = require('recursive-readdir'); | ||
const recursiveSync = require('recursive-readdir-sync'); | ||
@@ -50,2 +51,16 @@ if (process.platform !== 'win32') { | ||
/** | ||
* Retrieve all font files in the given directory (synchronous). | ||
* | ||
* @param {String} dir - The directory to read | ||
* @return {Promise} - Array of fonts | ||
*/ | ||
exports.getFontsInDirectorySync = dir => { | ||
try { | ||
return recursiveSync(dir); | ||
} catch (err) { | ||
return []; | ||
} | ||
}; | ||
/** | ||
* Get all fonts. | ||
@@ -58,1 +73,4 @@ * | ||
exports.getFontsInDirectory(FONT_DIRS[process.platform][useType]); | ||
exports.getAllSync = (useType = 'system') => | ||
exports.getFontsInDirectorySync(FONT_DIRS[process.platform][useType]); |
{ | ||
"name": "os-fonts", | ||
"description": "Retrieve fonts available on your OS.", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"author": "Vu Tran <vu@vu-tran.com>", | ||
"dependencies": { | ||
"recursive-readdir": "github:niftylettuce/recursive-readdir" | ||
"recursive-readdir": "^2.2.1", | ||
"recursive-readdir-sync": "^1.0.6" | ||
}, | ||
@@ -9,0 +10,0 @@ "devDependencies": { |
@@ -42,2 +42,6 @@ # os-fonts | ||
### getAllSync([useType]) | ||
Returns paths to all fonts (synchronous version of `getAll`). | ||
### getFontsInDirectory(dir) | ||
@@ -53,4 +57,8 @@ | ||
### getFontsInDirectory(dir) | ||
Returns paths to all fonts in the given directory (synchronous version of `getFontsInDirectory`). | ||
## License | ||
MIT © [Vu Tran](https://github.com/vutran/) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
100167
138
63
0
2
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedrecursive-readdir@2.2.3(transitive)
+ Addedrecursive-readdir-sync@1.0.6(transitive)
Updatedrecursive-readdir@^2.2.1