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
const callMethod = (methodName, ...params) => obj => obj[methodName](...params) | |
const awaitAll = promiseArray => Promise.all(promiseArray) | |
const prop = propName => obj => obj[propName] | |
const map = func => arr => arr.map(func) | |
const pipe = (...functions) => functions.reduce((compound, func) => (input => func(compound(input)))) | |
const download = url => fetch(url).then(callMethod("json")) | |
download( | |
"http://swapi.co/api/people/2/" | |
) |
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
/** | |
* Download a file (PDF in this case) from a secure URL after puppeteer login | |
**/ | |
// Puppeteer init | |
const browser = await puppeteer.launch(puppeteerOptions); | |
const page = await browser.newPage(); | |
page.setViewport({ width: 1366, height: 768 }); | |
// Add login logic |