Comparing version 0.2.10 to 0.2.11
@@ -45,2 +45,6 @@ | ||
================== | ||
- [feature] febs.utils.getTimeStringFromNow | ||
- [feature] febs.utils.getTimeStringFromNow | ||
0.2.11 | ||
================== | ||
- [bugfix] control upload. |
@@ -45,3 +45,3 @@ { | ||
"name": "febs", | ||
"version": "0.2.10" | ||
"version": "0.2.11" | ||
} |
@@ -0,0 +0,0 @@ febs 库是一些常用的工具的合集; |
exports.upload = require('./upload'); |
@@ -32,3 +32,2 @@ 'use strict'; | ||
function save_to(stream, writeStream, writeStreamPath, size, crc32, done) { | ||
// streams2+: assert the stream encoding is buffer. | ||
@@ -133,2 +132,4 @@ var state = stream._readableState; | ||
writeStream.removeListener('close', onFinish) | ||
writeStream.end() | ||
@@ -150,3 +151,3 @@ stream = writeStream = null | ||
*/ | ||
exports.accept = async function(app, conditionCB) | ||
exports.accept = function(app, conditionCB) | ||
{ | ||
@@ -192,12 +193,15 @@ assert(conditionCB); | ||
co(function* () { | ||
// yield each part as a stream | ||
var part; | ||
while (part = yield parts) { | ||
var srcStream = part; | ||
parts(function(err, part){ | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
conditionCB(query.data, Number(query.size), part.filename, part.mimeType) | ||
var srcStream = part; | ||
conditionCB(query.data, Number(query.size), part.filename, part.mimeType) | ||
.then(fn=>{ | ||
if (!fn) | ||
{ | ||
console.debug('febs upload.accpet un return a filename'); | ||
if (typeof srcStream.pause === 'function') | ||
@@ -227,23 +231,17 @@ srcStream.pause(); | ||
co(function* () { | ||
var ret = yield save_to(srcStream, destStream, fn, Number(query.size), Number(query.crc32)); | ||
return ret; | ||
}).then(function (value) { | ||
resolve(value); | ||
}, function (err) { | ||
reject(err); | ||
save_to(srcStream, destStream, fn, Number(query.size), Number(query.crc32), (err, ret)=>{ | ||
if (err) | ||
reject(err); | ||
else | ||
resolve(ret); | ||
}); | ||
}) | ||
.then(ret=>{ | ||
}) | ||
.catch(err=>{ | ||
reject(err); | ||
}); | ||
return; | ||
} | ||
}).then(function (value) { | ||
}, function (err) { | ||
reject(err); | ||
}); | ||
}); | ||
}; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
325788
1846