kevva / to-ico

Convert PNG to ICO in memory
MIT License
137 stars 19 forks source link

Is there a way to catch error? #12

Closed superliwei closed 7 years ago

superliwei commented 7 years ago

When i give a wrong image file like .jpg,error happened. I want to catch it and show a alert, is there a way to do this?

SamVerschueren commented 7 years ago

Probably this


toIco(files).then(buf => {
    fs.writeFileSync('favicon.ico', buf);
}).catch(err => {
    console.log(err);
});