init
This commit is contained in:
23
src/minio-listen/minio.ts
Normal file
23
src/minio-listen/minio.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Client } from 'minio';
|
||||
const minioClient = new Client({
|
||||
endPoint: 'localhost',
|
||||
port: 9000,
|
||||
useSSL: false,
|
||||
accessKey: 'admin',
|
||||
secretKey: 'admin123',
|
||||
});
|
||||
|
||||
// 监听事件
|
||||
const listen = async () => {
|
||||
const res = minioClient.listenBucketNotification('mark', 'common', '.md', [
|
||||
's3:ObjectCreated:*', // 监听所有对象创建事件
|
||||
// delete
|
||||
's3:ObjectRemoved:*',
|
||||
]);
|
||||
res.on('notification', (event) => {
|
||||
console.log(event);
|
||||
});
|
||||
// const res = await minioClient.getBucketNotification('mark');
|
||||
// console.log(res);
|
||||
};
|
||||
listen();
|
||||
Reference in New Issue
Block a user