This commit is contained in:
2025-06-06 17:00:30 +08:00
commit 55ddd8fca8
10 changed files with 3003 additions and 0 deletions

23
src/minio-listen/minio.ts Normal file
View 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();