Browse files

Renamed https' `stream` option to `buffer`

  • Loading branch information...
1 parent 6b1db2a commit 1e5668c5d0100a1b2a44a8110b9e0b450c9b1df5 @slaskis slaskis committed Mar 2, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/schemes/http.js
View
10 lib/schemes/http.js
@@ -32,6 +32,10 @@ catch(e) {
module.exports = function http(uri,opts,output){
uri.headers = opts.headers = opts.headers || {}
+
+ // Default to buffer (using `opts.stream` for backward compability)
+ if( !opts.hasOwnProperty('buffer') )
+ opts.buffer = !opts.stream;
// HTTP Auth
if( uri.userinfo && !uri.headers.authorization )
@@ -68,10 +72,10 @@ module.exports = function http(uri,opts,output){
res.pipe(stream = new compress.GunzipStream());
if( typeof output == "function" ){
- if( opts.stream ){
- output(null,stream);
- } else {
+ if( opts.buffer ){
utils.buffer(res.headers["content-type"],uri.pathname,stream,output)
+ } else {
+ output(null,stream);
}
} else {
stream.pipe(output);

0 comments on commit 1e5668c

Please sign in to comment.