1 | [![npm][download-badge]][npm]
|
2 | [![David][dep-badge]][dep-link]
|
3 | [![Coverage Status][coverage-badge]][coverage-link]
|
4 | [![Build Status][build-badge]][build-link]
|
5 |
|
6 | [![NPM][large-badge]][stats-link]
|
7 |
|
8 | # snekfetch <sup>[![Version Badge][version-badge]][npm]</sup>
|
9 |
|
10 | Snekfetch is a fast, efficient, and user-friendly library for making HTTP requests.
|
11 |
|
12 | The API was inspired by superagent, however it is much smaller and faster.
|
13 | In fact, in browser, it is a mere 4.8kb.
|
14 |
|
15 | Documentation is available at https://snekfetch.js.org/
|
16 |
|
17 | ## Some examples
|
18 |
|
19 | ```javascript
|
20 | const request = require('snekfetch');
|
21 |
|
22 | request.post('https://httpbin.org/post')
|
23 | .send({ usingGoodRequestLibrary: true })
|
24 | .then(r => console.log(r.body)); // r.body is object from json response
|
25 |
|
26 | request.get('https://s.gc.gy/o-SNAKES.jpg')
|
27 | .then(r => fs.writeFile('download.jpg', r.body)); // r.body is buffer
|
28 |
|
29 | request.get('https://s.gc.gy/o-SNAKES.jpg')
|
30 | .pipe(fs.createWriteStream('download.jpg')); // pipes
|
31 | ```
|
32 |
|
33 | Available for browser as UMD from [unpkg][unpkg-link]
|
34 | ```html
|
35 | <script src=https://unpkg.com/snekfetch></script>
|
36 | ```
|
37 |
|
38 | [npm]: https://npmjs.org/package/snekfetch
|
39 | [large-badge]: https://nodei.co/npm/snekfetch.png?downloads=true&downloadRank=true&stars=true
|
40 | [stats-link]: https://nodei.co/npm/snekfetch/
|
41 | [version-badge]: http://versionbadg.es/devsnek/snekfetch.svg
|
42 | [download-badge]: https://img.shields.io/npm/dt/snekfetch.svg?maxAge=3600
|
43 | [build-badge]: https://api.travis-ci.org/devsnek/snekfetch.svg?branch=master
|
44 | [build-link]: https://travis-ci.org/devsnek/snekfetch
|
45 | [dep-badge]: https://david-dm.org/guscaplan/snekfetch.svg
|
46 | [dep-link]: https://david-dm.org/guscaplan/snekfetch
|
47 | [coverage-badge]: https://coveralls.io/repos/github/devsnek/snekfetch/badge.svg?branch=master
|
48 | [coverage-link]: https://coveralls.io/github/devsnek/snekfetch?branch=master
|
49 | [unpkg-link]: https://unpkg.com/
|