将csvfile upload到数据库(leveldb)

我正在写一个小应用程序,并坚持在我想上传.csv文件的部分,并将条目存储到我的数据库。 我使用快递框架,并与多部门/公务员和强大的玩弄。 我成功上传了文件并将其保存在服务器上。 我现在可以提取数据并再次删除它,但是我认为使用Node.js更好的方法是将每行转换为数据库对象并将其存储,而不必将整个文件保存在服务器上。 我发现一些file upload的例子,但没有即将转换为对象/存储到数据库。 也许你能帮我吗?

下面你会看到上传路由的“发布”请求。

exports.uploadTradesProcess = function (req,res) { var form = new multiparty.Form(); form.onPart = function(part) { } form.parse(req, function(err, fields, files) { res.writeHead(200, {'content-type': 'text/plain'}); res.write('received upload:\n\n'); res.end(util.inspect({fields:fields, files:files})) }); return; } 

“form.onPart”行还没有做任何事情。 我想知道是否可以使上传文件中的每一个新行都切成块/部分…

这是数据库条目的模板:

 var Trade = new dulcimer.Model({ date: {type: 'integer'}, exchange: {type: 'string'}, currency1: {type: 'string'}, amount1: {type: 'numeric'}, currency2: {type: 'string'}, amount2: {type: 'numeric'}, exchangerate: { derive: function() { return this.currency1/this.currency2; } } }, {db: db, name: 'trade'}); 

这是我的第一篇文章stackoverflow,我希望它不是太长或太不明确,并会感谢您的反馈。 提前致谢。