Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/max-mapper/nets
nothing but nets. http client that works in node and browsers
https://github.com/max-mapper/nets
Last synced: 12 days ago
JSON representation
nothing but nets. http client that works in node and browsers
- Host: GitHub
- URL: https://github.com/max-mapper/nets
- Owner: max-mapper
- Created: 2014-05-21T13:27:34.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-19T22:01:10.000Z (over 9 years ago)
- Last Synced: 2025-01-03T01:15:35.908Z (16 days ago)
- Language: JavaScript
- Homepage: http://npmjs.org/nets
- Size: 188 KB
- Stars: 101
- Watchers: 6
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome-development - nets - HTTP client that works in node and browsers. (Packages / HTTP)
README
# nets
Mac/Linux | Windows
------------ | --------------
[![Travis](http://img.shields.io/travis/maxogden/nets.svg?style=flat)](https://travis-ci.org/maxogden/nets) | [![Build status](http://ci.appveyor.com/api/projects/status/vo5hdm5sdwaf7ss2)](https://ci.appveyor.com/project/maxogden/nets)[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard)
Nothin but nets. HTTP client that works the same in node and browsers
Uses [xhr](https://www.npmjs.org/package/xhr) for browsers and [request](https://www.npmjs.org/package/request) for node
#### get
```js
var nets = require("nets")nets({ url: "http://placekitten.com/g/400/400" }, function(err, resp, body) {
// body is a Buffer containing the image
})
```Note that `nets` returns data as [`Buffer`](http://nodejs.org/api/buffer.html)s by default, in both node and in browsers. You can pass `{encoding: undefined}` to turn this off.
#### post
```js
var nets = require("nets")nets({
body: '{"foo": "bar"}',
url: "/foo",
method: "POST",
headers: {
"Content-Type": "application/json"
}
}, function done (err, resp, body) {})
```