小编non*_*oom的帖子

类型错误:res.status 不是函数

我正在制作一个允许我在我的 express api(nodejs)中将图片上传到 imgur 的函数,在调用返回承诺的函数时遇到错误:

类型错误:res.status 不是 uploadpicture.then 的函数

这是我的代码: 引发错误的地方:

  router.post('/upload', (req, res, next)=> { 
    var busboy = new Busboy({headers: req.headers});
    busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
        if(fieldname == 'image') {
            // the buffer
            file.fileRead = [];
            file.on('data', function(data) {
                // add to the buffer as data comes in
                this.fileRead.push(data);
            });

            file.on('end', function() {
                // create a new stream with our buffered data
                var finalBuffer = Buffer.concat(this.fileRead);
                upload = uploadpicture(finalBuffer).then((res)=>{ //success request
                  console.log(res);
                  res.status(200).json({success: true, message: "Successfully uploaded …
Run Code Online (Sandbox Code Playgroud)

javascript api node.js promise express

10
推荐指数
3
解决办法
2万
查看次数

如何使用 webrtc 让我的用户保持匿名?

我需要在我的应用程序中实现视频通话,然后我发现了 webrtc,以及 nodejs 的 simple-peer。我只有一个问题,因为它是点对点的,我想用户不是匿名的,他们可以互相获取他们的 ip。

我知道 facebook、amazon chime 使用 webrtc,他们如何隐藏这些 ip?他们是否通过服务器传递流?使用转服务器?openvidu 会隐藏 ip 吗?或者我可以简单地为每个视频室在 nodejs 进程中创建对等点,并连接到每个用户并分发视频?
谢谢

security ip node.js webrtc openvidu

0
推荐指数
1
解决办法
470
查看次数

标签 统计

node.js ×2

api ×1

express ×1

ip ×1

javascript ×1

openvidu ×1

promise ×1

security ×1

webrtc ×1