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で画像の拡張子を取得するにはどうすればよいですか?