# fettuccine

> Simplified HTTP client with Promise API, every imaginable option but small file size

Latest version **1.0.4** (published 2018-03-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install fettuccine
pnpm add fettuccine
yarn add fettuccine
bun add fettuccine
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-03-22 |
| First published | 2015-12-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Shinnosuke Watanabe |
| Maintainers | shinnn |
| Keywords | request, http, https, small, lightweight, tiny, multipurpose, promise, promises, then, thenable, class, get, put, patch, post, head, delete |

## Links

- npm: https://www.npmjs.com/package/fettuccine
- Repository: https://github.com/shinnn/fettuccine
- Homepage: https://github.com/shinnn/fettuccine#readme
- Issues: https://github.com/shinnn/fettuccine/issues
- npm.io page: https://npm.io/package/fettuccine

## Dependencies (1)

- [fettuccine-class](https://npm.io/package/fettuccine-class.md) ^1.0.5

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2018-03-22
- 1.0.3 — 2017-05-11
- 1.0.2 — 2015-12-29
- 1.0.1 — 2015-12-22
- 1.0.0 — 2015-12-22
- 0.0.2 — 2015-12-17
- 0.0.1 — 2015-12-17
- 0.0.0 — 2015-12-15

## README

# fettuccine

[![npm version](https://img.shields.io/npm/v/fettuccine.svg)](https://www.npmjs.com/package/fettuccine)
[![Build Status](https://travis-ci.org/shinnn/fettuccine.svg?branch=master)](https://travis-ci.org/shinnn/fettuccine)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/fettuccine.svg)](https://coveralls.io/github/shinnn/fettuccine?branch=master)
[![Dependency Status](https://david-dm.org/shinnn/fettuccine.svg)](https://david-dm.org/shinnn/fettuccine)
[![devDependency Status](https://david-dm.org/shinnn/fettuccine/dev-status.svg)](https://david-dm.org/shinnn/fettuccine#info=devDependencies)

A simplified HTTP client for [Node](https://nodejs.org/)

* with the [Promise API](https://promisesaplus.com/)
* and [every imaginable option](https://github.com/request/request#requestoptions-callback) thanks to [Request](https://github.com/request/request),
* nevertheless, keeping [small package size](https://github.com/shinnn/load-request-from-cwd-or-npm#why) by [economical module loading](https://github.com/shinnn/load-request-from-cwd-or-npm)

```javascript
const fettuccine = require('fettuccine');

(async () => {
  const response = await fettuccine('https://api.github.com/users/isaacs/repos', {
    qs: {sort: 'created'},
    json: true
  });

  response.body[0]; //=> {id: 46883374, name: 'pseudomap', ...}
})();
```

## Installation

[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).

```
npm install fettuccine
```

## API

```javascript
const fettuccine = require('fettuccine');
```

### fettuccine(*url* [, *options*])

*url*: `string` (URL to send a request)  
*options*: `Object` (used as [`Request` options][request] with [`gzip`](https://github.com/request/request/blob/288f814e71efdd70f852888c1701c5cf3d177da5/request.js#L913-L928) defaulting to `true`)  
Return: `Promise<Object>`

It makes an HTTP or HTTPS request to the given URL.

When the request finishes, it will be [*fulfilled*](https://promisesaplus.com/#point-26) with the  [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_http_incomingmessage) object with the additional [`body` property][request]:

> `response` body (`String` or `Buffer`, or JSON object if the `json` option is supplied)

When the request fails, it will be [*rejected*](https://promisesaplus.com/#point-30) with an error object (usually from [`http.ClientRequest`](https://nodejs.org/api/http.html#http_class_http_clientrequest) object).

### fettuccine.get()

Alias of [`fettuccine()`][fettucine].

### fettuccine.post(), fettuccine.put(), fettuccine.patch(), fettuccine.head(), fettuccine.delete()

Set `options.method` to the method name and call [`fettuccine()`][fettucine].

```javascript
const fettuccine = require('fettuccine');

// With `fettuccine()`
(async () => {
  await fettuccine('https://awesome-webservice.com/api', {
    method: 'POST',
    body: imageBuffer
  });

  console.log('Uploaded an image.')
})();

// With `fettuccine.post()`
(async () => {
  await fettuccine.post('https://awesome-webservice.com/api', {
    body: imageBuffer
  });

  console.log('Uploaded an image.')
})();
```

### fettuccine.Fettuccine([*options*])

The [`Fettuccine` class](https://github.com/shinnn/fettuccine-class).

## License

[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe

[request]: https://github.com/request/request#requestoptions-callback
[fettucine]: https://github.com/shinnn/fettuccine#fettuccineurl--options

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