You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

fetch-no-cors

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-no-cors

Bypass CORS for browser's Fetch API

1.0.13
latest
Source
npmnpm
Version published
Weekly downloads
6
500%
Maintainers
1
Weekly downloads
 
Created
Source

Fetch No CORS

Bypass CORS for browser's Fetch API using https://github.com/Rob--W/cors-anywhere

  • Installation

npm:

npm i fetch-no-cors

yarn:

yarn add fetch-no-cors
  • Use

It's exactly like how we use the original fetch, you can either use it with await/async:

import fetchNoCors from "fetch-no-cors"

// You need to setup your own cors-anywhere proxy instance using https://github.com/Rob--W/cors-anywhere
const CORS_ANYWHERE = "https://my-own-cors-anywhere-proxy.com"
const foo = async (url, options, CORS_ANYWHERE) => {
  const res = await fetchNoCors(url, options)
  console.log(res)
}

or:

fetchNoCors(url, options, CORS_ANYWHERE)
  .then(res => console.log(res))
  .catch(err => console.error(err))

Keywords

fetch

FAQs

Package last updated on 29 Mar 2021

Did you know?

Socket

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