13
Node.js获取文件扩展名
我用Express 3在node.js中创建文件上传功能。 我想获取图像的文件扩展名。所以我可以重命名文件,然后将文件扩展名附加到它。 app.post('/upload', function(req, res, next) { var is = fs.createReadStream(req.files.upload.path), fileExt = '', // I want to get the extension of the image here os = fs.createWriteStream('public/images/users/' + req.session.adress + '.' + fileExt); }); 如何在node.js中获取图像的扩展名?