You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var parse = require('co-busboy');
app.use(function* (next) {
if (!this.request.is('multipart/*')) return yield next;
var parts = parse(this, {
checkFile: function (fieldname, filestream, filename) {
if (path.extname(filename) !== '.dat') {
return new Error('invalid filename extension');
}
}
});
var part;
try {
while (part = yield parts) {
if (part.length) {
console.log('key: ' + part[0]);
console.log('value: ' + part[1]);
} else {
part.pipe(fs.createWriteStream('some file.txt'))
}
}
catch (e) {
}
});
when upload a image file, the 'part' is FileStream instance.but it is no length method.
and then can't catch checkFile error. my request url's status always 'pending'.
i don't know why, pls help
The text was updated successfully, but these errors were encountered:
when upload a image file, the 'part' is FileStream instance.but it is no length method.
and then can't catch checkFile error. my request url's status always 'pending'.
i don't know why, pls help
The text was updated successfully, but these errors were encountered: