Closed rkreienbuehl closed 7 months ago
Please find an example below to get a presigned url with version id of an object :
import * as Minio from 'minio'
const s3Client = new Minio.Client({
endPoint: 'play.min.io',
port: 9000,
useSSL: true,
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
})
/**
* ➜ mc ls --versions play/minio-js-pre-ver
* [2024-02-07 14:07:51 IST] 117B STANDARD 29887028-16a7-4d97-a596-e7d0d5d8a297 v2 PUT 1.txt
* [2024-02-07 14:07:48 IST] 117B STANDARD 8bffeac7-257d-4bed-aed5-ce4801af5e03 v1 PUT 1.txt
*/
try {
const url = await s3Client.presignedUrl('GET', 'minio-js-pre-ver', '1.txt' , 600, { versionId:"8bffeac7-257d-4bed-aed5-ce4801af5e03" });
console.log('Success', url)
} catch (err) {
console.log(err.message)
}
output:
Success https://play.min.io:9000/minio-js-pre-ver/1.txt?versionId=8bffeac7-257d-4bed-aed5-ce4801af5e03&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=Q3AM3UQ867SPQQA43P2F%2F20240207%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240207T084010Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=e2d2bd4059ad856c1b944edb92d9e7f621a1e9becb7ceb1ed404c0266a42ea40
Is your feature request related to a problem? Please describe. Creating a presignedGetUrl is not possible for different versions of files.
Describe the solution you'd like It would be nice, if we can add a versionId to the call for getting a presignedGetUrl, so a specific version of a file can be downloaded.
Describe alternatives you've considered we use minio-js on our server-side. the only solution so far I found is, to download the file to the server and pass it to the client.