Added ability to output the buffer #95

wants to merge 1 commit into


None yet

2 participants


I've added ability to output the buffer.


var fs = require('fs');
var request = require('request');
var options = {
  method: 'GET',
  uri: "",
  output: "buffer"

request.get(options, function(error, response, body) {
  console.log(body instanceof Buffer); // => true
  fs.writeFile("profile.png", body);

Is it possible for you to merge this commit into your repository?

Dai Akatsuka.

mikeal commented Oct 26, 2011

what use case do you have for buffering the data and not converting it to a string?

usually when you want to keep it as a buffer you stream it (which disables buffering the bode entirely).


I think trying to use websocket (Node-WebSocket) for binary transfer of data.
Argument of sendBytes uses an instance of Buffer. SendBytes can directly be used if response hold the buffer.

websocket.on('connect', function(connection) {
  // snip

  request.get(options, function(error, response, body) {

  // snip
mikeal commented Feb 18, 2012

needs to be rebased. closing for now.

@mikeal mikeal closed this Feb 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment