728x90
반응형
MiniO 콘솔에서는 모든 오브젝트(파일)을 한번에 다운로드 받을 수 없다
결국 파일 하나씩 다운로드 받는걸 프로그래밍해서 전체 다운로드 받아야 함
https://www.npmjs.com/package/minio
minio
S3 Compatible Cloud Storage client. Latest version: 7.0.33, last published: 5 days ago. Start using minio in your project by running `npm i minio`. There are 400 other projects in the npm registry using minio.
www.npmjs.com
Minio Npm을 사용해서 가능함
const Minio = require('minio')
class DownloadObj
{
constructor()
{
this.endPoint = 'ip',
this.port = 9000,
this.accessKey = 'accessKey',
this.secretKey = 'secretKey'
this.bucketsNm = "Bucket Name";
this.path = null; //폴더경로 , prefix
this.minioClient = null;
this.run();
}
async run()
{
this.init();
this.objDown();
}
init()
{
let self = this;
this.minioClient = new Minio.Client({
endPoint:self.endPoint,
port: self.port,
useSSL: false,
accessKey: self.accessKey,
secretKey: self.secretKey
});
}
objDown()
{
let self = this;
let stream = this.minioClient.extensions.listObjectsV2WithMetadata(this.bucketsNm,this.path, true,'')
stream.on('data', function(obj) {
self.download( obj.name )
});
stream.on('error', function(err) {
console.log( err )
});
}
download(sFileNm){
this.minioClient.fGetObject(this.bucketsNm, sFileNm, `./${this.bucketsNm}/${sFileNm}`, function(err) {
if (err) {
console.log(`[ ### Download fail ] ${sFileNm}`)
}else{
console.log(`[ Download success ] ${sFileNm}`)
}
});
}
}
new DownloadObj();
Sample Git
https://github.com/Chung10Kr/DownloadMinio
GitHub - Chung10Kr/DownloadMinio
Contribute to Chung10Kr/DownloadMinio development by creating an account on GitHub.
github.com
반응형
'Dev > etc' 카테고리의 다른 글
[IntelliJ] 플러그인 - gitToolBox (0) | 2023.04.28 |
---|---|
Mac에서 마우스 오른쪽 클릭 terminal에서 vscode, 인텔리제이으로 열기, (0) | 2023.04.09 |
함수형 프로그래밍 (0) | 2023.02.23 |
메타프로그래밍 (0) | 2023.02.19 |
데이터 중심 아키텍처(DB/SQL 중심) (0) | 2023.02.08 |