mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Move core node icons into node package
This commit is contained in:
20
packages/node_modules/@node-red/runtime/api/nodes.js
generated
vendored
20
packages/node_modules/@node-red/runtime/api/nodes.js
generated
vendored
@@ -420,19 +420,23 @@ var api = module.exports = {
|
||||
* @param {User} opts.user - the user calling the api
|
||||
* @param {String} opts.module - the id of the module requesting the icon
|
||||
* @param {String} opts.icon - the name of the icon
|
||||
* @return {Promise<Buffer>} - the icon file as a Buffer
|
||||
* @return {Promise<Buffer>} - the icon file as a Buffer or null if no icon available
|
||||
* @memberof RED.nodes
|
||||
*/
|
||||
getIcon: function(opts) {
|
||||
return new Promise(function(resolve,reject) {
|
||||
var iconPath = runtime.nodes.getNodeIconPath(opts.module,opts.icon);
|
||||
fs.readFile(iconPath,function(err,data) {
|
||||
if (err) {
|
||||
err.status = 400;
|
||||
return reject(err);
|
||||
}
|
||||
return resolve(data)
|
||||
});
|
||||
if (iconPath) {
|
||||
fs.readFile(iconPath,function(err,data) {
|
||||
if (err) {
|
||||
err.status = 400;
|
||||
return reject(err);
|
||||
}
|
||||
return resolve(data)
|
||||
});
|
||||
} else {
|
||||
resolve(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user