<Object> 没有方法 'CreateReadStream'
<Object> has no method 'CreateReadStream'
我想使用 npm streaming-S3 并将视频上传到 S3。所以我在我的 node.js 应用程序中使用了以下代码。
var streamingS3 = require('streaming-s3'),
fs = require('fs');
var fStream = fs.CreateReadStream(__dirname + '/video.mp4');
var uploader = new streamingS3(fStream, {accessKeyId: process.env['AWS_ACCESS_KEY_ID'], secretAccessKey: secretAccessKey: process.env['AWS_SECRET_ACCESS_KEY']},
{
Bucket: 'example.streaming-s3.com',
Key: 'video.mp4',
ContentType: 'video/mp4'
}, function (err, resp, stats) {
if (err) return console.log('Upload error: ', e);
console.log('Upload stats: ', stats);
console.log('Upload successful: ', resp);
}
);
执行此代码后出现以下错误:
<Object has no method 'CreateReadStream'>
.
您的回答将很有价值。
节点 fs
模块中没有方法 CreateReadStream
。有createReadStream
(首字母必须小写):
var fStream = fs.createReadStream(__dirname + '/video.mp4');
我想使用 npm streaming-S3 并将视频上传到 S3。所以我在我的 node.js 应用程序中使用了以下代码。
var streamingS3 = require('streaming-s3'),
fs = require('fs');
var fStream = fs.CreateReadStream(__dirname + '/video.mp4');
var uploader = new streamingS3(fStream, {accessKeyId: process.env['AWS_ACCESS_KEY_ID'], secretAccessKey: secretAccessKey: process.env['AWS_SECRET_ACCESS_KEY']},
{
Bucket: 'example.streaming-s3.com',
Key: 'video.mp4',
ContentType: 'video/mp4'
}, function (err, resp, stats) {
if (err) return console.log('Upload error: ', e);
console.log('Upload stats: ', stats);
console.log('Upload successful: ', resp);
}
);
执行此代码后出现以下错误:
<Object has no method 'CreateReadStream'>
.
您的回答将很有价值。
节点 fs
模块中没有方法 CreateReadStream
。有createReadStream
(首字母必须小写):
var fStream = fs.createReadStream(__dirname + '/video.mp4');