我相信您可以通过上传到临时文件然后从那里读取来完成此操作。例如
// Since we don't provide any other 'opts' arguments to the upload
// method, it will upload our file to a temp directory
skipperFile.upload(function (err, uploadedFiles) {
// If no files were uploaded, respond with an error.
if (uploadedFiles.length === 0) {
return res.badRequest('No file was uploaded');
}
// Now that the file is uploaded, get the file descriptor
var fd = uploadedFiles[0].fd;
fs.readFile(fd, 'utf8', function (err, data) {
// Print the contents of the file as a string here
// and do whatever other string processing you want
console.log(data);
});
});
我是一名优秀的程序员,十分优秀!