Move core node icons into node package

This commit is contained in:
Nick O'Leary
2018-08-15 23:12:51 +01:00
parent a3aec6b939
commit a747d8c2d5
55 changed files with 30 additions and 26 deletions

View File

@@ -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);
}
});
}
}

View File

@@ -47,8 +47,8 @@
var fs = require('fs-extra');
var path = require("path");
var util = require("../../util");
var log = require("../../log");
var util = require("@node-red/util").util;
var log = require("@node-red/util").log;
var safeJSONStringify = require("json-stringify-safe");
var MemoryStore = require("./memory");