jeudi 2 avril 2015

Destroying Requests in Node

Recently, I've been trying to wrap my head around infintely long Readable streams using the request framework. The way I am implementing this is in a function that gets called several times with the intent of destroying the previous request. Like:



var request = require('request');

var start_request = function () {
curr = request(url).pipe(trumpet)
curr.destroy();
curr = request(url + mod).pipe(trumpet);
}


But unlike other Readable streams, it does not appear to have a destroy method, and if it call the start_request function several times, it just creates several requests. How can I destroy/cancel request?


Aucun commentaire:

Enregistrer un commentaire