JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10703
  • Score
    100M100P100Q153165F
  • License ISC

nothin but nets. http client that works in node and browsers

Package Exports

  • nets

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nets) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nets

Mac/Linux Windows
Travis Build status

js-standard-style

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 Buffers 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) {

})