Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support request: Piping #391

Closed
m1sta opened this Issue · 1 comment

2 participants

@m1sta

Hi,

Is it possible to pipe the response object provided in a callback, as per the below (which does not work)?

    request({ url: url, jar: cookieJar }, function (error, response, body) {
        if (!error && response.statusCode == 200) {
            res.writeHead(200, response.headers);
            res.pipe(body);
            console.log("Finished writing: " + url);
            console.log(JSON.stringify(response.headers));
        } else {
            console.log("An error occured.");
            console.log(JSON.stringify(error));
        }
    });
@FredKSchott
Collaborator

For this, you wouldn't want to use a callback. The "Streaming" section of the README should get you pointed in the right direction: https://github.com/mikeal/request#streaming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.