<object>没有方法'CreateReadStream'</object>

时间:2015-01-17 07:17:57

标签: node.js amazon-s3

我想使用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'>

你的答案很有价值。

1 个答案:

答案 0 :(得分:2)

节点CreateReadStream模块中没有方法fs。有createReadStream(首字母必须是小写):

var fStream = fs.createReadStream(__dirname + '/video.mp4');