Javascript 将unit8array转换为";stream.Readable";或;“缓冲区”;或;“字符串”;

Javascript 将unit8array转换为";stream.Readable";或;“缓冲区”;或;“字符串”;,javascript,node.js,amazon-s3,html5-canvas,minio,Javascript,Node.js,Amazon S3,Html5 Canvas,Minio,我正在尝试从视频帧中提取图像,然后导出到s3存储min.io() 使用putObject将图像写入s3存储桶时,第三个参数“content”需要是buffer/stream.readable/string。然而,从代码1中,我得到了unit8array的“内容”。我看了这个(),但似乎不适用于我的案例。欢迎任何提示 代码1: 这是从视频中提取图像的代码: if (!video) { video = document.createElement("video&q

我正在尝试从视频帧中提取图像,然后导出到s3存储min.io()

使用putObject将图像写入s3存储桶时,第三个参数“content”需要是buffer/stream.readable/string。然而,从代码1中,我得到了unit8array的“内容”。我看了这个(),但似乎不适用于我的案例。欢迎任何提示

代码1: 这是从视频中提取图像的代码:

 if (!video) {
            video = document.createElement("video");
            video.setAttribute("crossOrigin", "anonymous");

            if (cachingEnabled) {
                this.videoAssetFiles[asset.parent.name] = video;
                refresh = true;
            }
        }

        video.onloadedmetadata = () => {
            video.currentTime = asset.timestamp;
        };
        video.onseeked = () => {
            const canvas = document.createElement("canvas");
            canvas.height = video.videoHeight;
            canvas.width = video.videoWidth;
            const ctx = canvas.getContext("2d");
            ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
            canvas.toBlob(resolve, "image/jpeg", 1.0); // inside which it calls writeBinary
        };
代码2:这是将图像写入min.io s3 bucket的代码,该存储内容应该是流/缓冲区

public async writeBinary(blobName: string, content: Buffer) {
    const bucketName = this.options.folderName;

    await minioClient.putObject(bucketName, blobName, content, function(
        err: string,
        etag: string
    ) {
        return console.log(`"${bucketName} ${blobName}: "`, err, etag);
    });
}
错误: 未处理的拒绝(TypeError):第三个参数的类型应为“stream.Readable”或“Buffer”或“string”

17 |} 十八|

19 |导出类MinioStorageProvider{ 20 | /** 21 |*存储类型 22 |*@returns-StorageType.Cloud

16 | secrect?:字符串; 17 | } 十八|

19 |导出类MinioStorageProvider{ 20 | /** 21 |*存储类型 22 |*@returns-StorageType.Cloud

16 |     secrect?: string;