Huge News!Announcing our $40M Series B led by Abstract Ventures.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 - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

8

lib/response.js

@@ -28,2 +28,8 @@ const { Readable } = require('bare-stream')

// https://fetch.spec.whatwg.org/#dom-body-bytes
async bytes () {
return this.buffer()
}
// https://fetch.spec.whatwg.org/#dom-body-arraybuffer
async arrayBuffer () {

@@ -33,2 +39,3 @@ return (await this.buffer()).buffer

// https://fetch.spec.whatwg.org/#dom-body-text
async text () {

@@ -38,2 +45,3 @@ return (await this.buffer()).toString('utf8')

// https://fetch.spec.whatwg.org/#dom-body-json
async json () {

@@ -40,0 +48,0 @@ return JSON.parse(await this.text())

3

package.json
{
"name": "bare-fetch",
"version": "1.3.1",
"version": "1.4.0",
"description": "Minimal WHATWG Fetch implementation for Bare",

@@ -8,2 +8,3 @@ "exports": {

"./package": "./package.json",
"./global": "./global.js",
"./errors": "./lib/errors.js",

@@ -10,0 +11,0 @@ "./response": "./lib/response.js",

@@ -27,31 +27,44 @@ # bare-fetch

#### `response.buffer()`
Consumes the stream and returns a buffer.
#### `response.headers`
#### `response.arrayBuffer()`
Consumes the stream and returns an array buffer.
The response headers.
#### `response.text()`
Consumes the stream, parses it as utf8 and returns a string.
#### `response.body`
#### `response.json() `
Consumes the stream, parses it as json and returns a js object.
The `Readable` body stream.
#### `response.headers`
The headers on the response.
#### `response.bodyUsed`
#### `response.body`
The `Readable` stream wrapped by the response.
Whether or not the stream has already been consumed.
#### `response.bodyUsed`
A boolean property that tracks whether the stream has already been consumed.
#### `response.status`
The http status code of the response.
The HTTP status code of the response.
#### `response.redirected`
A boolean property that tracks whether the request has been redirected to a different URL.
Whether or not the request has been redirected to a different URL.
#### `response.buffer()`
Consumes the stream and returns a `Buffer`.
#### `response.bytes()`
Consumes the stream and returns a `Uint8Array`.
#### `response.arrayBuffer()`
Consumes the stream and returns an `ArrayBuffer`.
#### `response.text()`
Consumes the stream and returns a UTF-8 string.
#### `response.json() `
Consumes the stream and returns a JSON value.
## License
Apache-2.0
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