fix(baoyu-compress-image): rename original as backup instead of deleting
This commit is contained in:
parent
5e597f0a8b
commit
366630f8c3
|
|
@ -147,7 +147,9 @@ async function processFile(
|
|||
const outputSize = statSync(tempOutput).size;
|
||||
|
||||
if (!opts.keep && absInput !== output) {
|
||||
unlinkSync(absInput);
|
||||
const ext = extname(absInput);
|
||||
const base = absInput.slice(0, -ext.length);
|
||||
renameSync(absInput, `${base}_original${ext}`);
|
||||
}
|
||||
renameSync(tempOutput, output);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue