# tinyget

> A tiny http client for nodejs & browser

Latest version **0.2.13** (published 2018-06-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.13 |
| Published | 2018-06-05 |
| First published | 2016-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 238.2 KB |
| Known vulnerabilities | 0 (+17 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | joje |
| Maintainers | attrs, joje |
| Keywords | ajax |

## Links

- npm: https://www.npmjs.com/package/tinyget
- Repository: https://github.com/attrs/tinyget
- Issues: https://github.com/attrs/tinyget/issues
- npm.io page: https://npm.io/package/tinyget

## Dependencies (3)

- [jsdom](https://npm.io/package/jsdom.md) ^8.5.0
- [xmldom](https://npm.io/package/xmldom.md) ^0.1.22
- [request](https://npm.io/package/request.md) ^2.72.0

## Recent versions

- 0.2.13 (latest) — 2018-06-05
- 0.2.12 — 2018-01-11
- 0.2.11 — 2018-01-11
- 0.2.10 — 2017-11-29
- 0.2.9 — 2017-06-08
- 0.2.8 — 2017-04-10
- 0.2.7 — 2017-04-09
- 0.2.6 — 2017-04-09
- 0.2.5 — 2017-04-08
- 0.2.4 — 2017-01-30
- 0.2.3 — 2017-01-12
- 0.2.2 — 2017-01-12
- 0.2.1 — 2017-01-11
- 0.2.0 — 2017-01-02
- 0.1.12 — 2017-01-01
- … 24 more at https://npm.io/package/tinyget/versions

## README

# tinyget

A tiny http client for nodejs & browser

[![NPM Version][npm-version]][npm-url] [![NPM Downloads][npm-total]][npm-url] [![NPM Downloads][npm-month]][npm-url] [![NPM Downloads][license]][npm-url]

[npm-version]: https://img.shields.io/npm/v/tinyget.svg?style=flat
[npm-url]: https://npmjs.org/package/tinyget
[npm-total]: https://img.shields.io/npm/dt/tinyget.svg?style=flat
[npm-month]: https://img.shields.io/npm/dm/tinyget.svg?style=flat
[license]: https://img.shields.io/npm/l/tinyget.svg?style=flat


## Installation
```sh
$ npm install tinyget --save
```

Or, via [`webmodules`](https://github.com/attrs/webmodules)
```sh
$ wpm install tinyget --save
```

Or, via [`bower`](http://bower.io)
```sh
$ bower install tinyget --save
```

## Usage
### Node.js (commonjs)
```javascript
var tinyget = require('tinyget');
```

### Browser (global)
```javascript
var tinyget = window.TinyGet;
```

### Example
```javascript
// default is get
tinyget('/path/file').qry({key: value}).exec(function(err, result) {
    // TODO
});

// get, post, put, delete, options
tinyget.post('/path/file').payload({key:'value'}).exec(function(err, result) {
    // TODO
});

// alt style 1
tinyget({
    url: '/path/file',
    payload: {key:'value'}
}).exec(function(err, result) {
    // TODO
});

tinyget.post({
    url: '/path/file',
    contentType: 'application/json',
    evalType: 'json',
    payload: {key:'value'}
}).exec(function(err, result) {
    // TODO
});

// alt style 2
tinyget({
    url: '/path/file',
    payload: {key:'value'}
}, function(err, result) {
    // TODO
});

tinyget.put({
    url: '/path/file',
    payload: {key:'value'}
}, function(err, result) {
    // TODO
});
```

### Options
- options : url string or object
    - url: remote url(string), required.
    - payload: payload (string/object), default is null.
    - qry: query string (string/object), default is null.
    - contentType: request content-type (string), default when payload is object `application/json` else `text/form-url-encoded`
    - responseType: xhr.responseType(xhr2) (string), default is null
    - type: response object eval type `text, json, xml` (string), default is `auto`
    - headers: request headers (object), default is null.
    - sync: sync request (boolean), default is false

### License
Licensed under the MIT License.
See [LICENSE](./LICENSE) for the full license text.

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