https://github.com/devsnek/snekfetch
fast, efficient, and user-friendly http requests
https://github.com/devsnek/snekfetch
badge browser browser-request cool coverage-badge coverage-link deflate-response deps-badge deps-link fast gzip-response http http-client http-request nodejs stats-link tiny unpkg unpkg-link
Last synced: 11 days ago
JSON representation
fast, efficient, and user-friendly http requests
- Host: GitHub
- URL: https://github.com/devsnek/snekfetch
- Owner: devsnek
- License: mit
- Archived: true
- Created: 2017-03-10T06:57:42.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-05T19:12:58.000Z (over 7 years ago)
- Last Synced: 2025-08-15T01:35:52.217Z (5 months ago)
- Topics: badge, browser, browser-request, cool, coverage-badge, coverage-link, deflate-response, deps-badge, deps-link, fast, gzip-response, http, http-client, http-request, nodejs, stats-link, tiny, unpkg, unpkg-link
- Language: JavaScript
- Homepage: https://snekfetch.js.org/
- Size: 1.59 MB
- Stars: 77
- Watchers: 8
- Forks: 21
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![npm][download-badge]][npm]
[![David][dep-badge]][dep-link]
[![Coverage Status][coverage-badge]][coverage-link]
[![Build Status][build-badge]][build-link]
[![NPM][large-badge]][stats-link]
# snekfetch [![Version Badge][version-badge]][npm]
Snekfetch is a fast, efficient, and user-friendly library for making HTTP requests.
It also supports native ALPN negotiation in node for efficient http/2 requests!
The API was inspired by superagent, however it is much smaller and faster.
In fact, in browser, it is a mere 4.0kb.
Documentation is available at https://snekfetch.js.org/
## Some examples
```javascript
const request = require('snekfetch');
request.post('https://httpbin.org/post')
.send({ usingGoodRequestLibrary: true })
.then(r => console.log(r.body)); // r.body is object from json response
request.get('https://s.gc.gy/o-SNAKES.jpg')
.then(r => fs.writeFile('download.jpg', r.body)); // r.body is buffer
request.get('https://s.gc.gy/o-SNAKES.jpg')
.pipe(fs.createWriteStream('download.jpg')); // pipes
```
Available for browser as UMD from [unpkg][unpkg-link]
```html
```
[npm]: https://npmjs.org/package/snekfetch
[large-badge]: https://nodei.co/npm/snekfetch.png?downloads=true&downloadRank=true&stars=true
[stats-link]: https://nodei.co/npm/snekfetch/
[version-badge]: https://versionbadge.now.sh/npm/snekfetch.svg
[download-badge]: https://img.shields.io/npm/dt/snekfetch.svg?maxAge=3600
[build-badge]: https://api.travis-ci.com/devsnek/snekfetch.svg?branch=master
[build-link]: https://travis-ci.com/devsnek/snekfetch
[dep-badge]: https://david-dm.org/devsnek/snekfetch.svg
[dep-link]: https://david-dm.org/devsnek/snekfetch
[coverage-badge]: https://coveralls.io/repos/github/devsnek/snekfetch/badge.svg?branch=master
[coverage-link]: https://coveralls.io/github/devsnek/snekfetch?branch=master
[unpkg-link]: https://unpkg.com/