Skip to content

Instantly share code, notes, and snippets.

@yungwarlock
Created August 21, 2023 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yungwarlock/5c95fd97cb8a6fb273507f66eb497870 to your computer and use it in GitHub Desktop.
Save yungwarlock/5c95fd97cb8a6fb273507f66eb497870 to your computer and use it in GitHub Desktop.
Uploading a file using file stream to firebase storage
// async function uploadCourseThumbnail(path: string) {
// const fileID = createID();
// const file = storage.file(`${fileID}.png`);
// file.makePublic();
// return new Promise((resolve, reject) => {
// const publicUrl = file.publicUrl();
// fs.createReadStream(path)
// .pipe(file.createWriteStream({
// metadata: {
// contentType: "image/png",
// }
// }))
// .on("error", (err) => {
// reject(err);
// })
// .on("close", () => {
// resolve(publicUrl);
// });
// });
// }
// async function getVideoMetadata(videoPath: string): Promise<ffmpeg.FfprobeData> {
// return new Promise((resolve, reject) => {
// ffmpeg.ffprobe(videoPath, (err, metadata) => {
// if (err) {
// return reject(err);
// }
// resolve(metadata);
// });
// });
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment