A JS package that:
- fetches an array of URLs
- returns their contents in a promise
Install
npm install sab-req-mul-url
Dependencies
node-fetch: A light-weight module that brings window.fetch to Node.js
Example below
const returnAllUrls = require('sab-req-mul-url');
const urls = [
'https://ft-tech-test-example.s3-eu-west-1.amazonaws.com/ftse-fsi.json',
'https://ft-tech-test-example.s3-eu-west-1.amazonaws.com/gbp-hkd.json',
'https://ft-tech-test-example.s3-eu-west-1.amazonaws.com/gbp-usd.json'
];
const getMultipleUrls = () => {
const data = returnAllUrls(urls)
.then(data => console.log(data))
.catch(error => console.error(error))
}