mirror of
https://github.com/openharmony/developtools_ace-js2bundle.git
synced 2026-07-20 21:59:23 -04:00
fixed 42a80b9 from https://gitee.com/fanjiaojiaoar/developtools_ace-js2bundle/pulls/331
保留lite图片后缀 Signed-off-by: fanjiaojiao <fanjiaojiao@huawei.com>
This commit is contained in:
@@ -64,8 +64,11 @@ async function img2bin(imgPath) {
|
||||
binView.setUint8(binFileOffset, alpha, true);
|
||||
binFileOffset += 1;
|
||||
});
|
||||
const binPath = imgPath.replace(/(\.png|\.jpg|\.bmp|\.jpeg|\.BMP|\.JPG|\.PNG|\.JPEG)$/, '.bin');
|
||||
fs.writeFileSync(binPath, Buffer.from(binBuffer));
|
||||
const binPath1 = imgPath.replace(/(\.png|\.jpg|\.bmp|\.jpeg|\.BMP|\.JPG|\.PNG|\.JPEG)$/, '.bin');
|
||||
const binPath2 = imgPath+".bin";
|
||||
fs.writeFileSync(binPath1, Buffer.from(binBuffer));
|
||||
fs.writeFileSync(binPath2, Buffer.from(binBuffer));
|
||||
|
||||
} catch (err) {
|
||||
const imageName = _path.basename(imgPath);
|
||||
console.error('\u001b[31m', `Failed to convert image ${imageName}.`, '\u001b[39m');
|
||||
|
||||
Reference in New Issue
Block a user