# get

> A slightly higher-level HTTP client for node.

Latest version **1.4.0** (published 2014-11-25) · 0 weekly downloads

## Install

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

## 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.4.0 |
| Published | 2014-11-25 |
| First published | 2011-04-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.3.6 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tom MacWright |
| Maintainers | tmcw, kkaefer, yhahn, willwhite, springmeyer |
| Keywords | http, client, request, get |

## Links

- npm: https://www.npmjs.com/package/get
- Repository: https://github.com/mapbox/node-get
- Issues: https://github.com/mapbox/node-get/issues
- npm.io page: https://npm.io/package/get

## 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.4.0 (latest) — 2014-11-25
- 1.3.0 — 2013-09-16
- 1.2.1 — 2012-11-01
- 1.2.0 — 2012-09-19
- 1.1.10 — 2012-08-30
- 1.1.9 — 2012-08-03
- 1.1.8 — 2012-07-12
- 1.1.7 — 2012-07-11
- 1.1.6 — 2012-04-26
- 1.1.5 — 2012-04-05
- 1.1.4 — 2012-03-11
- 1.1.3 — 2012-03-08
- 1.1.2 — 2011-12-01
- 1.1.1 — 2011-11-30
- 1.1.0 — 2011-10-17
- … 7 more at https://npm.io/package/get/versions

## README

# get [![Build Status](https://secure.travis-ci.org/mapbox/node-get.png?branch=master)](http://travis-ci.org/mapbox/node-get)

`get` is a slightly higher-level HTTP client for nodejs.

## Installation

    npm install get

get has no dependencies.

For testing, you'll need make and [mocha](https://github.com/visionmedia/mocha).

For docs you'll need [docco](https://github.com/jashkenas/docco).

## Features

* Redirect following.
* Convenience functions for downloading and getting data as string.
* Binary-extension and basic binary detection.
* Configurable headers

## API

Downloads are objects in `get`.

```javascript
var dl = new get({ uri: 'http://google.com/' });
```

However, the function is [a�self-calling constructor](http://ejohn.org/blog/simple-class-instantiation/), and�thus the `new` keyword is�not necessary:

```javascript
var dl = get({ uri: 'http://google.com/' });
```

The get constructor can also take a plain string if you don't want to give options.

```javascript
var dl = get('http://google.com/');
```

It can also take other options.

```javascript
var dl = get({
    uri: 'http://google.com/',
    max_redirs: 20,
});
```

Then it exposes three main methods

```javascript
dl.asString(function(err, str) {
    console.log(str);
});
```

and

```javascript
dl.toDisk('myfile.txt', function(err, filename) {
    console.log(err);
});
```

and finally

```javascript
dl.asBuffer(function(err, data) {
    console.log(data);
});
```


There's also a lower-level API.

```javascript
dl.perform(function(err, response) {
    // response is just a response object, just like
    // HTTP request, except handling redirects
});
```

If you give node-get an object of settings instead of a string,
it accepts

* `uri` - the address of the resource
* `headers` - to replace its default headers with custom ones
* `max_redirs` - the number of redirects to follow before returning an error
* `no_proxy` - don't use a HTTP proxy, even if one is in `ENV`
* `encoding` - When calling `.guessEncoding()`, `get` will use this instead of the default value

## Example

```
var get = require('get');

get('http://google.com/').asString(function(err, data) {
    if (err) throw err;
    console.log(data);
});
```

## TODO:

* Guessing encoding wth headers
* User-customizable encodings

## Authors

* Tom MacWright (tmcw)
* Konstantin Kaefer (kkaefer)

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