Created
February 6, 2019 22:23
-
-
Save mhkeller/58dc737a1f69f406b4e8921bb4e6a301 to your computer and use it in GitHub Desktop.
promisified wget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function downloadPage (matches) { | |
for (let match of matches) { | |
const requestUrl = `tktk`; | |
const html = await wget(requestUrl); | |
} | |
} | |
async function wget (requestUrl) { | |
return new Promise((resolve, reject) => { | |
const cmd = `wget -q -O - '${requestUrl}'`; | |
child.exec(cmd, (err, stdout, stderr) => { | |
return err ? reject(err) : resolve(stdout); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment