googleapis / googleapis/google-api-nodejs-client
how can upload the video on youtube without fs.creatReadStream() in node js?
- Dominant language
- TypeScript
- Stars
- 12.2k
- Forks
- 2k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 24
Description
Hi, community,
I use node js and google API NPM with both I want to upload a video on the user's youtube account but I couldn't figure out how to pass the request.file into the insert function of the package, I know that for local files i have to use fs.createReadStream() but for request.file I can not use that so how can I pass video file data to youtube api?
I tried with some thing buffer but not working:-
service.videos.insert(
{
auth: oauth2Client,
part: "snippet,status",
requestBody: {
snippet: {
title: "Xyz2",
description: "abc",
categoryId: 28,
defaultAudioLanguage: "en",
defaultLanguage: "en",
},
status: {
privacyStatus: "public",
},
},
media: {
mimeType:"video/*",
body: Buffer.from(req.files.video),
},
},
(err, response) => {
console.log('response: ', response);
if (err) {
console.log(err);
}
// fs.unlink(`${req.files.video.name.replace(/ /g, '')}`)
var subscribers = response.data.items;
console.log(subscribers);
res.send({ subscribers });
}
);
Not working
Please help,thank you
Contributor guide
Assessment
This issue has not been assessed yet.