Closed jodhykardo closed 3 years ago
Use wget or aria2c instead of Buffer which has more resources for your device
for example you can use this code
function os_func() {
this.execCommand = function (cmd) {
return new Promise((resolve, reject)=> {
exec(cmd, (error, stdout, stderr) => {
if (error) {
reject(error);
return;
}
resolve(stdout)
});
})
}
}
var os = new os_func();
os.execCommand('wget "https://site.com/vid.mp4" -o videofolder/result.mp4').then(res=> {
var media = MessageMedia.fromFilePath('videofolder/result.mp4');
chat.sendMessage(media);
}).catch(err=> {
console.log("os >>>", err);
})
Use wget or aria2c instead of Buffer which has more resources for your device
for example you can use this code
function os_func() { this.execCommand = function (cmd) { return new Promise((resolve, reject)=> { exec(cmd, (error, stdout, stderr) => { if (error) { reject(error); return; } resolve(stdout) }); }) } } var os = new os_func(); os.execCommand('wget "https://site.com/vid.mp4" -o videofolder/result.mp4').then(res=> { var media = MessageMedia.fromFilePath('videofolder/result.mp4'); chat.sendMessage(media); }).catch(err=> { console.log("os >>>", err); })
The condition is the BOT receiving media message, the data is in base64, so i need to buffer it to save the media in the BOT server.
That's also happenning with me
but in upload file... if you try to send this file works ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi,
Right now i'm developing chat system through REST API. For the media in chat, BOT must download the file and then serves it as link to PHP server. The chat system work perfectly fine until someone sent a video with size 17MB. The BOT don't downloading the video and it just freeze without any error log. The BOT don't even reply any messages automatically after freeze. But, if video size is below 10MB, it can download the video and work perfectly fine.
Here is my code:
`const chatId = msg.id.id; const chatAck = msg.ack; const chatMessage = msg.body; const chatTime = msg.timestamp; const chatFrom = msg.from; const chatTo = msg.to; const chatAuthor = msg.author; const chatType = msg.type; const chatMediaKey = msg.mediaKey; const chatName = chat.name; const username = chatName.replace(" ", "-"); console.log("Before IF");
WhatsApp
Library
node -v
): v12.16.0npm -v
): 6.13.4Additional context
Add any other context about the problem here.