# kefir-fetch

> [Kefir](https://github.com/rpominov/kefir) wrapper around [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) with JSON-friendly defaults

Latest version **0.1.15** (published 2018-09-06) · 0 weekly downloads

## Install

```sh
npm install kefir-fetch
pnpm add kefir-fetch
yarn add kefir-fetch
bun add kefir-fetch
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.15 |
| Published | 2018-09-06 |
| First published | 2016-06-02 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | brynwaldwick, spro |
| Keywords | kefir, fetch |

## Links

- npm: https://www.npmjs.com/package/kefir-fetch
- Repository: https://github.com/prontotype-us/kefir-fetch
- Homepage: https://github.com/prontotype-us/kefir-fetch#readme
- Issues: https://github.com/prontotype-us/kefir-fetch/issues
- npm.io page: https://npm.io/package/kefir-fetch

## Dependencies (4)

- [kefir](https://npm.io/package/kefir.md) 3.2.x
- [buffer](https://npm.io/package/buffer.md) 4.9.x
- [deep-extend](https://npm.io/package/deep-extend.md) 0.4.x
- [whatwg-fetch](https://npm.io/package/whatwg-fetch.md) 1.0.0

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 0.1.15 (latest) — 2018-09-06
- 0.1.14 — 2017-06-27
- 0.1.13 — 2017-06-19
- 0.1.12 — 2016-09-25
- 0.1.11 — 2016-09-25
- 0.1.10 — 2016-09-18
- 0.1.9 — 2016-09-17
- 0.1.8 — 2016-09-17
- 0.1.7 — 2016-09-16
- 0.1.6 — 2016-06-21
- 0.1.5 — 2016-06-17
- 0.1.4 — 2016-06-16
- 0.1.3 — 2016-06-16
- 0.1.2 — 2016-06-12
- 0.1.1 — 2016-06-03
- … 1 more at https://npm.io/package/kefir-fetch/versions

## README

# kefir-fetch

[Kefir](https://github.com/rpominov/kefir)  wrapper around [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) with JSON-friendly defaults

## Installation

```
npm install kefir-fetch
```

## Usage

`fetch$(method, path, options?)`

The optional `options` argument may include:

* `body`: JSON request body
* `query`: JSON query object, which is encoded and appended to the URL
* `headers`: Override HTTP headers, which by default are:
    * `"Accept": "application/json"`
    * `"Content-Type": "application/json"`
* `base_url`: Base URL to prepend path to, useful for non-web apps

### Default options

`fetch$.setDefaultOptions(options)`

To override the default options for all requests, use `setDefaultOptions`.

## Examples

```coffee
fetch$ = require 'kefir-fetch'

# Get an item

fetch$('get', '/item/55.json').onValue (item) ->
    console.log "Got item:", item

# Update some item, using the body option

update = {score: 0.43}

fetch$('put', '/items/55.json', {body: update}).onValue (updated) ->
    console.log "Updated item:", updated

# Search for some items, using the query option

search = {q: "some"}

fetch$('get', '/items.json', {query: search}).onValue (items) ->
    console.log "Found items:", items
```

---
_Source: https://npm.io/package/kefir-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
