Can you tell me how to perform Resumable upload using this module: )
DiyRex opened this issue · comments
const fs = require('fs');
const fbUpload = require('facebook-api-video-upload');
const args = {
token: "XXXXXXXXXXXXXXXXXX", // with the permission to upload
id: "XXXXXXXXXXXXX", //The id represent {page_id || group_id}
stream: fs.createReadStream('./video.mkv'), //path to the video,
title: "my video",
description: "my description",
thumb: {
value: fs.createReadStream('./video.jpg'),
options: {
filename: 'fixture.jpg',
contentType: 'image/jpg'
}
}
// if you want the default thumb from the video just remove the field
// you can add any extra fields from the api https://developers.facebook.com/docs/graph-api/reference/page/videos/#Creating
// all keys except token, id, stream are passed to the final request
};
fbUpload(args).then((res) => {
console.log('res: ', res);
//res: { success: true, video_id: '1838312909759132' }
// https://www.facebook.com/100080206917420/videos/1062597247944821/
}).catch((e) => {
console.error(e);
});
This example work fine in pc but when upload big files it failed bcz my server has low ram (512mb)
Im newbie :)
You can't. This module load the video in ram before upload.
It should be possible to do a chunk upload by reading and sending only the chunk.
Pr are welcome