
The following warning is emitted by Node.js: > DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new > Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or > `Buffer.alloc()` instead. This patch removes this warning.
22 lines
598 B
JavaScript
22 lines
598 B
JavaScript
var fs = require('fs');
|
|
var path = require('path');
|
|
|
|
var loadLogos = function() {
|
|
var logos = {};
|
|
var logoFiles = fs.readdirSync(path.join(__dirname, '..', 'logo'));
|
|
logoFiles.forEach(function(filename) {
|
|
if (filename[0] === '.') { return; }
|
|
// filename is eg, github.svg
|
|
var svg = fs.readFileSync(
|
|
path.join(__dirname, '..', 'logo', filename)).toString();
|
|
|
|
// eg, github
|
|
var name = filename.slice(0, -('.svg'.length));
|
|
logos[name] = 'data:image/svg+xml;base64,' +
|
|
Buffer.from(svg).toString('base64');
|
|
});
|
|
return logos;
|
|
};
|
|
|
|
module.exports = loadLogos;
|