尝试将blob对象发送到我的节点服务器.在客户端,我正在使用MediaRecorder录制一些音频,然后我想将文件发送到我的服务器进行处理.
saveButton.onclick = function(e, audio) {
var blobData = localStorage.getItem('recording');
console.log(blobData);
var fd = new FormData();
fd.append('upl', blobData, 'blobby.raw');
fetch('/api/test',
{
method: 'post',
body: fd
})
.then(function(response) {
console.log('done');
return response;
})
.catch(function(err){
console.log(err);
});
}
Run Code Online (Sandbox Code Playgroud)
这是我的快速路线,它使用了multer:
var upload = multer({ dest: __dirname + '/../public/uploads/' });
var type = upload.single('upl');
app.post('/api/test', type, function (req, res) {
console.log(req.body);
console.log(req.file);
// do stuff with file
});
Run Code Online (Sandbox Code Playgroud)
但是我的日志什么都没有
{ upl: '' }
undefined
Run Code Online (Sandbox Code Playgroud)
花了很长时间在这上面,所以任何帮助赞赏!
我如何简单地将多行复制粘贴到 mongo shell 中。是使用脚本文件的唯一方法吗?我想快速插入一堆数据,但发生以下情况:
> db.mycollection.insert([
... {
... title: 'MongoDB Overview',
... description: 'MongoDB is no sql database',
... by: 'tutorials point',
... url: 'http://www.tutorialspoint.com',
... tags: ['mongodb', 'database', 'NoSQL'],
... likes: 100
... },
...
... {
... title: 'NoSQL Database',
... description: 'NoSQL database doesn't have tables',
2016-06-14T17:40:30.303+0100 E QUERY [thread1] SyntaxError: missing } after property list @(shell):13:41
> by: 'tutorials point',
... url: 'http://www.tutorialspoint.com',
... tags: ['mongodb', 'database', 'NoSQL'],
... likes: 20,
... comments: [
... …Run Code Online (Sandbox Code Playgroud) 如果有人能指出我在这里缺少的东西,那将不胜感激
我是新的,但我没有遇到错误命名html文件的情况,因为php可能不好.
也许这对开发人员来说不那么令人困惑?
如果我正在设置一个项目并运行 npm install -abc xyz,我是否可以在另一个终端实例中为同一个项目运行另一个 npm install,同时它仍在运行?
谢谢!
试图了解python库是否已编译,因为我想知道我编写的解释代码是执行相同还是更差.
例如,我看到它在某处提到numpy和scipy是有效的,因为它们是编译的.我不认为这意味着字节码被编译,所以这是怎么做到的?它是用cython这样的东西编译成c的吗?或者它是使用像c这样的语言编写的,并以兼容的方式编译?
这是适用于所有模块还是根据具体情况而定?
我是AWS和服务器的初学者
我在笔记本电脑1上登录AWS并设置了EC2实例.第二天,我在笔记本电脑2上登录AWS控制台,然后实例消失了.所以我设置了另一个EC2实例.然后在第二天使用第三台笔记本电脑登录到控制台,我找到了我的第一个实例但不是第二个...
第二个实例仍在运行,因为我可以访问IP ..
知道为什么会这样吗?这真令人困惑和讨厌
谢谢!