<commit_before># simple-get [![travis](https://img.shields.io/travis/feross/simple-get.svg)](https://travis-ci.org/feross/simple-get) [![npm](https://img.shields.io/npm/v/simple-get.svg)](https://npmjs.org/package/simple-get) [![downloads](https://img.shields.io/npm/dm/simple-get.svg)](https://npmjs.org/package/simple-get)

### Simplest way to make http get requests

## features

This module is designed to be the lightest possible wrapper on top of node.js `http`, but supporting:

- follows redirects
- automatically handles gzip/deflate responses
- supports HTTPS
- supports convenience `url` key so there's no need to use `url.parse` on the url when specifying options

All this in < 100 lines of code.

## install

```
npm install simple-get
```

## usage

```js
var get = require('simple-get')

get('http://example.com', function (err, res) {
  if (err) throw err
  console.log(res.statusCode) // 200
  res.pipe(process.stdout) // `res` is a stream
})
```

A more complex example:

```js
var get = require('simple-get')
var concat = require('concat-stream')

get({
  url: 'http://example.com',
  maxRedirects: 3, // default value is 10 
  
  // simple-get accepts all options that node.js `http` accepts
  // See: http://nodejs.org/api/http.html#http_http_request_options_callback
  headers: {
    'user-agent': 'my cool app'
  }
}, function (err, res) {
  if (err) throw err
  
  // All properties/methods from http.IncomingResponse are available,
  // even if a gunzip/inflate transform stream was returned.
  // See: http://nodejs.org/api/http.html#http_http_incomingmessage
  res.setTimeout(10000)
  console.log(res.headers)
  
  res.pipe(concat(function (data) {
    // `data` is the decoded response, after it's been gunzipped or inflated
    // (if applicable)
    console.log('got the response: ' + data)
  }))
  
})
```

## license
<commit_msg>remove maxRedirects option from example<commit_after># simple-get [![travis](https://img.shields.io/travis/feross/simple-get.svg)](https://travis-ci.org/feross/simple-get) [![npm](https://img.shields.io/npm/v/simple-get.svg)](https://npmjs.org/package/simple-get) [![downloads](https://img.shields.io/npm/dm/simple-get.svg)](https://npmjs.org/package/simple-get)

### Simplest way to make http get requests

## features

This module is designed to be the lightest possible wrapper on top of node.js `http`, but supporting:

- follows redirects
- automatically handles gzip/deflate responses
- supports HTTPS
- supports convenience `url` key so there's no need to use `url.parse` on the url when specifying options

All this in < 100 lines of code.

## install

```
npm install simple-get
```

## usage

```js
var get = require('simple-get')

get('http://example.com', function (err, res) {
  if (err) throw err
  console.log(res.statusCode) // 200
  res.pipe(process.stdout) // `res` is a stream
})
```

A more complex example:

```js
var get = require('simple-get')
var concat = require('concat-stream')

get({
  url: 'http://example.com',

  // simple-get accepts all options that node.js `http` accepts
  // See: http://nodejs.org/api/http.html#http_http_request_options_callback
  headers: {
    'user-agent': 'my cool app'
  }
}, function (err, res) {
  if (err) throw err

  // All properties/methods from http.IncomingResponse are available,
  // even if a gunzip/inflate transform stream was returned.
  // See: http://nodejs.org/api/http.html#http_http_incomingmessage
  res.setTimeout(10000)
  console.log(res.headers)

  res.pipe(concat(function (data) {
    // `data` is the decoded response, after it's been gunzipped or inflated
    // (if applicable)
    console.log('got the response: ' + data)
  }))

})
```

## license

{'fraction_non_alphanumeric': 0.15247364152473641, 'fraction_numerical': 0.006758583400919167, 'mean_word_length': 3.7865459249676583, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7401190', 'n_tokens_mistral': 1282, 'n_tokens_neox': 1208, 'n_words': 330}