首页 > 解决方案 > 在firebase云功能中通过fs JavaScript读取mp4

问题描述

我需要通过 fs 或 firebase 云函数中 JavaScript 中的任何其他包将 mp4 文件读取为 4D 数组(RGB、宽度、高度和时间)。

exports.readNewVideo = functions.storage
    .object().onFinalize(async (object) => {
        const bucket = admin.storage().bucket(object.bucket);
        const tempFilePath = path.join(os.tmpdir(), object.name);
        await bucket.file(object.name!).download({ destination: tempFilePath });
        // read here by tempFilePath 
    });

标签: javascriptnode.jsgoogle-cloud-firestoregoogle-cloud-functions

解决方案


推荐阅读