const fs = require('fs');
const { readPsd } = require('ag-psd');
module.exports = function (path) {
try {
const buffer = fs.readFileSync(path);
const psd = readPsd(buffer, { skipLayerImageData: true, skipCompositeImageData: true, skipThumbnail: true });
let fontNameList = [];
psd.children.forEach((layer) => {
if (layer.text) fontNameList.push(layer.text.style.font.name);
});
return fontNameList;
} catch(e) {
return false
}
}