$ cnpm install sync-fetch
Synchronous wrapper around the Fetch API. Uses node-fetch under the hood, and for some input-parsing code and test cases too.
npm install sync-fetch
const fetch = require('sync-fetch')
const metadata = fetch('https://doi.org/10.7717/peerj-cs.214', {
headers: {
Accept: 'application/vnd.citationstyles.csl+json'
}
}).json()
// json(), arrayBuffer(), text() and buffer() supported
Streams (or FormData) as input bodies since they cannot be read or serialized synchronouslyBlobs as input bodies since they're too complexagent option as its value cannot be serializedXMLHttpRequest is pretty limited. Supported are:
methodbodyheaderscredentials (but not omit)timeoutCopyright 2013 - present © cnpmjs.org | Home |