我正在使用fixorientation节点模块,因为我将本地图像上传到fixOrientation函数。抛出错误"第一个参数必须是字符串,Buffer,ArrayBuffer,Array或类似数组的对象"。我做错了什么?如何解决这个问题。遵循此文档:https://www.npmjs.com/package/fix-orientation
文件夹结构
nodeapp
app.js
var express = require('express'),
bodyParser = require('body-parser'),
http = require('http'),
path = require('path'),
app = express(),
server = http.createServer(app);
app.use(bodyParser.urlencoded({extended: true}));
app.use(express.static(path.join(__dirname, '/')));
app.listen(3000);
global.atob = require("atob");
var fixOrientation = require('fix-orientation');
app.get('/', function(req, res){
// var url = '/D:/node/orio/test.jpg';
fixOrientation('test.jpg', { image: true }, function (fixed, image) {
var img = new Image();
img.src = fixed;
document.body.appendChild(img);
document.body.appendChild(image);
});
})