【问题标题】:How to get actual image or video from minio server如何从 minio 服务器获取实际图像或视频
【发布时间】:2018-11-13 06:31:48
【问题描述】:

我已经从我的 android 客户端在 minio 服务器 (https://play.minio.io:9000) 中上传了一些图像和视频。现在我已经能够从该文件夹下载上传的内容。我可以看到内容不是实际的图像/视频,而是向我展示了一些加密格式。我的问题是如何获取我上传的实际图像/视频。有没有这样的工具或我能做的其他事情?

任何帮助将不胜感激..

提前致谢。

【问题讨论】:

    标签: minio


    【解决方案1】:

    这是我在 minio 中预览图像的解决方案

    # set alias
    mc alias set myminio HOST:9000 MINIO_CLIENT MINIO_SECRET
    
    # create bucket
    mc mb myminio/image
    
    # set policy for the bucket
    mc policy set download myminio/image
    

    我的上传功能

    const fs = require('fs');
    const file = './cat.jpg';
    const fileStream = fs.createReadStream(file);
    
    const metadata = {
      'Content-type': 'image',
    };
    
    const upload = async () => {
      const etag = await minioClient.putObject(
        'image',
        'cat.jpg',
        fileStream,
        metadata // this metadata in important to preview image from browser instead of download
      );
      console.log({ etag });
    };
    
    

    现在导航到 http://localhost:9000/image/cat.jpg

    您将通过直接链接看到您的猫图片。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-02
      • 2013-12-07
      • 2019-09-23
      • 1970-01-01
      • 2012-08-27
      相关资源
      最近更新 更多