gistlib
index.tsimport * as minio from 'minio'; import * as fs from 'fs'; const minioClient = new minio.Client({ endPoint: 'minio-server-ip', port: 9000, useSSL: false, accessKey: 'your-access-key', secretKey: 'your-secret-key' }); const bucketName = 'your-bucket-name'; const objectName = 'your-object-name'; const filePath = 'path-to-save-file'; const file = fs.createWriteStream(filePath); minioClient.getObject(bucketName, objectName, function(err, dataStream) { if (err) { return console.log(err); } dataStream.pipe(file); }); 561 chars25 lines
import * as minio from 'minio'; import * as fs from 'fs'; const minioClient = new minio.Client({ endPoint: 'minio-server-ip', port: 9000, useSSL: false, accessKey: 'your-access-key', secretKey: 'your-secret-key' }); const bucketName = 'your-bucket-name'; const objectName = 'your-object-name'; const filePath = 'path-to-save-file'; const file = fs.createWriteStream(filePath); minioClient.getObject(bucketName, objectName, function(err, dataStream) { if (err) { return console.log(err); } dataStream.pipe(file); });
gistlibby LogSnag