BedrockStreaming/superagent-mock

Stream support

austinkelleher opened this issue · 2 comments

I want to mock a superagent request that creates pipes the data to a write stream e.g.

const targz = require('tar.gz2');
const request = require('superagent');

const tarball = 'some-file.tgz';
const read = request.get(tarball);
const write = targz().createWriteStream(dir);

const stream = read.pipe(write).on('finish', doSomething);

Unfortunately superagent-mock doesn't support this feature for now... But if you want, you can propose a PR 😉

It doesn't look like too hard. It is only a node feature. https://github.com/visionmedia/superagent/blob/master/lib/node/index.js