New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bare-fetch

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-fetch

Minimal WHATWG Fetch implementation for Bare

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
137
decreased by-12.18%
Maintainers
0
Weekly downloads
 
Created
Source

bare-fetch

Minimal WHATWG Fetch implementation for Bare.

npm i bare-fetch

Usage

link must be a string containing an http or https url

The function returns a Promise that resolves to a Response object .

The Response wraps a Readable stream.

import fetch from 'bare-fetch'

const res = await fetch('https://api.restful-api.dev/objects/7')

console.log(await res.text())

Only 'GET', 'POST' and 'PUT' are currently supported.

Class: Response

response.buffer()

Consumes the stream and returns a buffer.

response.text()

Consumes the stream, parses it as utf8 and returns a string.

response.json()

Consumes the stream, parses it as json and returns a js object.

response.headers

The headers on the response.

response.body

The Readable stream wrapped by the response.

response.bodyUsed

A boolean property that tracks whether the stream has already been consumed.

response.status

The http status code of the response.

response.redirected

A boolean property that tracks whether the request has been redirected to a different URL.

License

Apache-2.0

FAQs

Package last updated on 21 Aug 2024

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc