update
This commit is contained in:
22
src/test/create-bucket.ts
Normal file
22
src/test/create-bucket.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Client } from 'minio'
|
||||
|
||||
export async function createBucket(client: Client, bucketName: string) {
|
||||
const exists = await client.bucketExists(bucketName)
|
||||
if (!exists) {
|
||||
await client.makeBucket(bucketName, '')
|
||||
console.log(`Bucket "${bucketName}" created successfully.`)
|
||||
} else {
|
||||
console.log(`Bucket "${bucketName}" already exists.`)
|
||||
}
|
||||
}
|
||||
|
||||
const minioClient = new Client({
|
||||
endPoint: 'minio.kevisual.cn',
|
||||
port: 9000,
|
||||
useSSL: false,
|
||||
accessKey: 'admin',
|
||||
secretKey: 'xiongxiao',
|
||||
})
|
||||
createBucket(minioClient, 'nocodb').catch((err) => {
|
||||
console.error('Error creating bucket:', err)
|
||||
})
|
||||
Reference in New Issue
Block a user