maxogden / Nets
nothing but nets. http client that works in node and browsers
Stars: ✭ 101
Programming Languages
javascript
184084 projects - #8 most used programming language
nets
Mac/Linux | Windows |
---|---|
Nothin but nets. HTTP client that works the same in node and browsers
Uses xhr for browsers and request for node
get
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
s by default, in both node and in browsers. You can pass {encoding: undefined}
to turn this off.
post
var nets = require("nets")
nets({
body: '{"foo": "bar"}',
url: "/foo",
method: "POST",
headers: {
"Content-Type": "application/json"
}
}, function done (err, resp, body) {
})
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].