Commit 183b25b2 authored by 张九刚's avatar 张九刚

修改node版本

parent 005b9d53
...@@ -32,10 +32,9 @@ const offsetAll = 176; ...@@ -32,10 +32,9 @@ const offsetAll = 176;
async function execute(psdFile, options) { async function execute(psdFile, options) {
console.log("psdFile:", psdFile); console.log("psdFile:", psdFile);
const { imagesPath } = options; const { projectPath } = options;
if(!imagesPath) if (!projectPath) {
{
console.log("没有指定cache目录"); console.log("没有指定cache目录");
} }
...@@ -237,7 +236,11 @@ async function execute(psdFile, options) { ...@@ -237,7 +236,11 @@ async function execute(psdFile, options) {
let buffer; let buffer;
try { try {
let img = node.origin.toPng(); let img = node.origin.toPng();
const imageFilePath = path.join(imagesPath, uuid + ext); let cachePath = path.join(projectPath, '/assestcache/');
if (!fs.existsSync(cachePath)) {
fs.mkdirsSync(cachePath);
}
const imageFilePath = path.join(projectPath, '/assestcache/' + uuid + ext);
buffer = await savePng(img, imageFilePath).catch(e => { buffer = await savePng(img, imageFilePath).catch(e => {
}); });
dataUrl = buffer.toString('base64'); dataUrl = buffer.toString('base64');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment