package
Synchronous version of the Fetch API
npm install sync-fetchGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Synchronous wrapper around the Fetch API. Uses node-fetch.
For a package using version of fetch built into Node.js, see sync-fetch-undici.
npm install sync-fetchIn the browser, a browserify bundle can be loaded from CDNs like unpkg.com.
<script src="https://unpkg.com/sync-fetch"></script>
<script src="https://unpkg.com/sync-fetch@VERSION"></script>const fetch = require('sync-fetch')
const metadata = fetch('https://doi.org/10.7717/peerj-cs.214', {
headers: {
Accept: 'application/vnd.citationstyles.csl+json'
}
}).json()
// arrayBuffer(), blob(), buffer(), json(), and text() supportedStream or Blob as input body since they cannot be read or serialized synchronouslyFormData as input body yet as it can contain a Blobsignal as it cannot be implemented synchronouslyagent option as its value cannot be serializedtextConverted() method on SyncResponse and SyncRequestXMLHttpRequest is pretty limited. Supported are:
methodbodyheaderscredentials (but not omit)timeoutbuffer() and textConverted() methods are not supportedEstimated unpacked size across 8 packages.
266.6 kB
Includes dependencies.
3 direct dependencies.