0.6.2 • Published 13 years ago

curly v0.6.2

Weekly downloads
103
License
-
Repository
-
Last release
13 years ago

curly

a request module for node.js using cascading syntax
it's available through npm

npm install curly

more examples are coming but curly just exposes all the http methods and you config it using cascades.

var curly = require('curly');

curly.get('http://google.com', callback);
curly.get('http://google.com').send(callback); // above is sugar for this

curly.get('http://google.com')
	 .query({hello:'world'}, callback); // adds a query string

curly.get('https://some-json-service.com')
	 .reuse()
	 .query({meh:'bar'})
	 .json(callback); // reuse means adding keep-alive and we expect json back

to use custom headers use the headers function

curly.get('http://google.com').headers({'user-agent':'curly'}, callback);

curly.get('http://google.com')
	 .headers({'user-agent':'curly'})
	 .buffer(callback); // let's get is as a buffer

curly can also stream and pipe

curly.put('http://file-upload-service.com/meh').from(inputStream).pipe(outputStream);

pipe is also aliased to to for consistency with from. the above methods can ofcourse be chained with any of the other events.

besides put and get curly supports post, del and head.
the object returned from any of the methods is also an EventEmitter and emits response, data,close and end events.

var req = curly.get('http://google.com').end().on('response', function(response) {
	console.log('here we have the classic response - also available through req.response');
});

the above could also be expressed as

var req = curly.get('http://google.com').end(function(err, response) {
	console.log('now we have error handling');
});
0.6.2

13 years ago

0.6.1

13 years ago

0.6.0

13 years ago

0.5.3

13 years ago

0.5.2

13 years ago

0.5.1

13 years ago

0.5.0

13 years ago

0.4.4

13 years ago

0.4.3

13 years ago

0.4.2

13 years ago

0.4.1

13 years ago

0.4.0

13 years ago

0.2.10

13 years ago

0.2.9

13 years ago

0.2.7

14 years ago

0.2.6

14 years ago

0.2.5

14 years ago

0.2.4

14 years ago

0.2.2

14 years ago

0.2.1

14 years ago

0.2.0

14 years ago

0.1.8

14 years ago

0.1.7

14 years ago

0.1.6

14 years ago

0.1.5

14 years ago

0.1.4

14 years ago

0.1.3

14 years ago

0.1.2

14 years ago

0.1.1

14 years ago

0.1.0

14 years ago