minio

Visualize file without download it minio


I'm using Minio to store files, and I need to visualize some of this files from my browser without download it. I used this piece of code, however it downloads the file unfortunately.

minioClient.getObjectUrl(bucketName, ObjectName)

Thank you


Solution

  • Regarding MinIO doc, we can get stored object url, and for that I've used this piece of code :

    // Get presigned URL of an object for HTTP method, expiry time and custom request parameters.
        Map<String, String> reqParams = new HashMap<>();
                reqParams.put("response-content-type", "application/pdf"); //very helpfull to preview pdf from browser
                return minioClient.getPresignedObjectUrl(Method.GET,bucketName,objectName,expiryTime,reqParams);