Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

febs

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

febs - npm Package Compare versions

Comparing version 0.2.11 to 0.2.12

@@ -45,3 +45,3 @@ {

"name": "febs",
"version": "0.2.11"
"version": "0.2.12"
}

@@ -115,7 +115,7 @@ 'use strict';

}
else
done(null, true);
// else
// done(null, true);
}
function cleanup(err) {
function cleanup(err, cb) {
if (err) {

@@ -132,5 +132,21 @@ writeStream.destroy()

writeStream.removeListener('close', onFinish)
writeStream.end()
if (!err) {
var tempStream = writeStream;
function _onError() {
tempStream.removeListener('finish', _onFlush)
tempStream = null;
done(null, false);
}
function _onFlush() {
tempStream.removeListener('error', _onError)
tempStream = null;
done(null, true);
}
writeStream.once('finish', _onFlush)
writeStream.once('error', _onError)
writeStream.end()
}
stream = writeStream = null

@@ -199,2 +215,4 @@ }

var srcStream = part;
var destStream;
var fn1;
conditionCB(query.data, Number(query.size), part.filename, part.mimeType)

@@ -211,8 +229,8 @@ .then(fn=>{

req.destroy();
resolve(false);
return;
return false;
}
fn1 = fn;
// create stream.
var destStream = fs.createWriteStream(fn);
destStream = fs.createWriteStream(fn);
if (!destStream)

@@ -227,14 +245,19 @@ {

req.destroy();
resolve(false);
return;
return false;
}
save_to(srcStream, destStream, fn, Number(query.size), Number(query.crc32), (err, ret)=>{
if (err)
reject(err);
else
resolve(ret);
});
return true;
})
.then(ret=>{
if (!ret) {
resolve(false);
}
else {
save_to(srcStream, destStream, fn1, Number(query.size), Number(query.crc32), (err, ret)=>{
if (err)
reject(err);
else
resolve(ret);
});
}
})

@@ -241,0 +264,0 @@ .catch(err=>{