function runSample (fileName, callback) {
  const fileSize = fs.statSync(fileName).size;
  youtube.videos.insert({
    part: 'id,snippet,status',
    notifySubscribers: false,
    resource: {
      snippet: {
        title: 'Node.js YouTube Upload Test',
        description: 'Testing YouTube upload via Google APIs Node.js Client'
      },
      status: {
        privacyStatus: 'private'
      }
    },
    media: {
      body: fs.createReadStream(fileName)
    }
  }, {
    // Use the `onUploadProgress` event from Axios to track the
    // number of bytes uploaded to this point.
    onUploadProgress: evt => {
      const progress = (evt.bytesRead / fileSize) * 100;
      process.stdout.clearLine();
      process.stdout.cursorTo(0);
      process.stdout.write(`${Math.round(progress)}% complete`);
    }
  }, (err, res) => {
    if (err) {
      throw err;
    }
    console.log('\n\n');
    console.log(res.data);
    callback(res.data);
  });
}
// very basic example of uploading a video to youtube
very basic example of uploading a video to youtube
very basic example of uploading a video to youtube
function runSample (fileName, callback) {
  const fileSize = fs.statSync(fileName).size;
  youtube.videos.insert({
    part: 'id,snippet,status',
    notifySubscribers: false,
    resource: {
      snippet: {
        title: 'Node.js YouTube Upload Test',
        description: 'Testing YouTube upload via Google APIs Node.js Client'
      },
      status: {
        privacyStatus: 'private'
      }
    },
    media: {
      body: fs.createReadStream(fileName)
    }
  }, {
    onUploadProgress: evt => {
      const progress = (evt.bytesRead / fileSize) * 100;
      process.stdout.clearLine();
      process.stdout.cursorTo(0);
      process.stdout.write(`${Math.round(progress)}% complete`);
    }
  }, (err, res) => {
    if (err) {
      throw err;
    }
    console.log('\n\n');
    console.log(res.data);
    callback(res.data);
  });
}
function runSample ( fileName , callback ) { const fileSize = fs . statSync ( fileName ) . size ; youtube . videos . insert ( { part : 'id,snippet,status' , notifySubscribers : false , resource : { snippet : { title : 'Node.js YouTube Upload Test' , description : 'Testing YouTube upload via Google APIs Node.js Client' } , status : { privacyStatus : 'private' } } , media : { body : fs . createReadStream ( fileName ) } } , { onUploadProgress : evt => { const progress = ( evt . bytesRead / fileSize ) * 100 ; process . stdout . clearLine ( ) ; process . stdout . cursorTo ( 0 ) ; process . stdout . write ( ` ${ Math . round ( progress ) } ` ) ; } } , ( err , res ) => { if ( err ) { throw err ; } console . log ( '\n\n' ) ; console . log ( res . data ) ; callback ( res . data ) ; } ) ; }
very basic example of uploading a video to youtube
very basic example of uploading a video to youtube
// Use the `onUploadProgress` event from Axios to track the // number of bytes uploaded to this point.