Socket
Socket
Sign inDemoInstall

sync-fetch

Package Overview
Dependencies
2
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sync-fetch

Synchronous version of the Fetch API


Version published
Weekly downloads
571K
decreased by-6.83%
Maintainers
1
Install size
378 kB
Created
Weekly downloads
 

Changelog

Source

0.3.0 (2020-11-02)

  • chore!: drop node 8 and add 14 (b8b3e6c)

BREAKING CHANGES

  • drop Node 8 support

Readme

Source

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

npm install sync-fetch

Use

const fetch = require('sync-fetch')

const metadata = fetch('https://doi.org/10.7717/peerj-cs.214', {
  headers: {
    Accept: 'application/vnd.citationstyles.csl+json'
  }
}).json()

Limitations

Node.js

  • Does not support Streams (or FormData) as input bodies since they cannot be read or serialized synchronously
  • Does not support Blobs as input bodies since they're too complex
  • Does not support the non-spec agent option as its value cannot be serialized

Browser

  • Does not support most options, since XMLHttpRequest is pretty limited. Supported are:
    • method
    • body
    • headers
    • credentials (but not omit)
    • (Non-spec) timeout
  • Does not support binary responses in the main thread
  • CORS limitations apply, of course (note they may be stricter for synchronous requests)

Keywords

FAQs

Last updated on 02 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc