Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Node.js HTTP Client

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
docs
examples
lib
test
.gitignore
AUTHORS
Cakefile
LICENSE
ReadMe.md
package.json

ReadMe.md

Introduction

Shred is an HTTP client library for node.js that makes writing HTTP clients fun and easy.

var Shred = require("shred");
var shred = new Shred;

shred.get({
  url: "http://api.spire.io/",
  headers: {
    accept: "application/json"
  }
}).on({
  // you can use response codes as events
  200: function(response) {
    console.log(response.content.data);
  },
  // any other response means something's wrong
  response: function(response) {
    console.log("Oh no!");
  }
});

The response was JSON, but Shred handles that for you because we specified application/json in the Accept header. So we're able to access it via response.content.data.

See the wiki for more examples.

Also, we wrote a blog post on why we wrote Shred instead of going with existing libraries.

Installation

Just npm install shred and you're good to go.

Feedback

Feedback is highly encouraged in the form of tickets or pull requests. Thank you!

Code

Browse the annotated source.

We'd love your contributions - don't hesitate to send us pull requests. We'll also happily add you as a committer after we've accepted it.

License

Shred is MIT licensed.

Authors

Shred is based on code originally written by Matthew King. That code was adapted and converted into a separate Node.js library by Dan Yoder and Jason Campbell.

Something went wrong with that request. Please try again.