Hormis Lona
Hormis Lona

Reputation: 523

<Object> has no method 'CreateReadStream'

I want to use npm streaming-S3 and upload video into S3. So i use the following code in my node.js application.

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);
  }
);

After executing this code i got the following error :

<Object has no method 'CreateReadStream'>.

Your answers will be valuable.

Upvotes: 0

Views: 164

Answers (1)

alexpods
alexpods

Reputation: 48545

There is no method CreateReadStream in node fs module. There is createReadStream (first letter must be in lower case):

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

Upvotes: 2

Related Questions