diff --git a/emoji-kitchen/emoji-kitchen.js b/emoji-kitchen/emoji-kitchen.js index 04592ef..ce2199a 100755 --- a/emoji-kitchen/emoji-kitchen.js +++ b/emoji-kitchen/emoji-kitchen.js @@ -149,16 +149,19 @@ function download(pngUrl, downloadMonitor) { let pngPath = `${KITCHEN_DATA_DIR}/${pngName}`; if (!fs.existsSync(pngPath)) { - const stream = fs.createWriteStream(pngPath); + const fileStream = fs.createWriteStream(pngPath); const getter = pngUrl.startsWith('https:') ? https : http; + console.log(`Downloading ${pngUrl}`); getter.get(pngUrl, REQUEST_OPTS, (response) => { - console.log(`Downloading ${pngUrl}`); - response.pipe(stream); - downloadMonitor.set(pngUrl, true); - // Set icon to itself so that when dragging from - // Alfred's results, you see the sticker and not - // the generic png icon. - spawn(`${WF_DIR}/set_icon.sh`, [pngPath, pngPath]); + response.pipe(fileStream); + fileStream.on('finish', () => { + downloadMonitor.set(pngUrl, true); + // Set icon to itself so that when dragging from + // Alfred's results, you see the sticker and not + // the generic png icon. + spawn(`${WF_DIR}/set_icon.sh`, [pngPath, pngPath]); + console.log(`Finished download: ${pngPath}`); + }); }); } else { downloadMonitor.set(pngUrl, true); diff --git a/info.plist b/info.plist index afad626..b6de53f 100644 --- a/info.plist +++ b/info.plist @@ -884,7 +884,7 @@ xattr -d com.apple.quarantine ./impbcopy 2> /dev/null > /dev/null version - 0.1.2 + 0.1.3 webaddress https://github.com/mr-pennyworth/alfred-fastest-emoji