2.2.0 • Published 6 months ago

bare-fetch v2.2.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

bare-fetch

WHATWG Fetch implementation for Bare.

npm i bare-fetch

Usage

const fetch = require('bare-fetch')

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

console.log(await res.text())

API

const response = await fetch(url[, options])

Response

response.headers

The response headers.

response.status

The HTTP status code of the response.

response.redirected

Whether or not the request has been redirected to a different URL.

response.body

The response body stream.

response.bodyUsed

Whether or not the stream has already been consumed.

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

2.2.0

6 months ago

2.1.2

7 months ago

2.1.1

7 months ago

2.1.3

7 months ago

2.1.0

7 months ago

2.0.0

7 months ago

1.6.0

7 months ago

1.5.1

8 months ago

1.5.0

8 months ago

1.4.0

8 months ago

1.3.1

9 months ago

1.2.0

11 months ago

1.1.0

12 months ago

1.0.0

1 year ago