$ npm install @ardatan/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
Stream
s (or FormData
) as input bodies since they cannot be read or serialized synchronouslyBlob
s as input bodies since they're too complexagent
option as its value cannot be serializedXMLHttpRequest
is pretty limited. Supported are:
method
body
headers
credentials
(but not omit
)timeout
© 2010 - cnpmjs.org x YWFE | Home | YWFE