fix(rest) add lReadStream.on(error, lError)

This commit is contained in:
coderaiser 2013-08-09 12:19:12 +00:00
parent d693b3838b
commit b02e35ed97

View file

@ -147,9 +147,16 @@
else {
lName = p.name;
lError = function(pError) {
main.sendError(pParams, pError);
};
if (lQuery === 'zip') {
lZlib = zlib.createGzip();
lReadStream = fs.createReadStream(lName);
lReadStream.on('error', lError);
lReadStream = lReadStream.pipe(lZlib);
lName += '.' + lQuery;
lMsg = lQuery;
@ -160,10 +167,6 @@
lWriteStream = fs.createWriteStream(lName);
lError = function(pError) {
main.sendError(pParams, pError);
};
lWriteStream.on('error', lError);
lReadStream.on('error', lError);