init
This commit is contained in:
17
services/client-mark/package.json
Normal file
17
services/client-mark/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "client-mark",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||
"license": "MIT",
|
||||
"packageManager": "pnpm@10.6.2",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.14.1"
|
||||
}
|
||||
}
|
||||
29
services/client-mark/pnpm-lock.yaml
generated
Normal file
29
services/client-mark/pnpm-lock.yaml
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: ^22.14.1
|
||||
version: 22.14.1
|
||||
|
||||
packages:
|
||||
|
||||
'@types/node@22.14.1':
|
||||
resolution: {integrity: sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==}
|
||||
|
||||
undici-types@6.21.0:
|
||||
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
||||
|
||||
snapshots:
|
||||
|
||||
'@types/node@22.14.1':
|
||||
dependencies:
|
||||
undici-types: 6.21.0
|
||||
|
||||
undici-types@6.21.0: {}
|
||||
41
services/client-mark/src/listen.ts
Normal file
41
services/client-mark/src/listen.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import AWS from 'aws-sdk';
|
||||
import { Client } from 'minio';
|
||||
const minioClient = new Client({
|
||||
endPoint: 'localhost',
|
||||
port: 9000,
|
||||
useSSL: false,
|
||||
accessKey: 'admin',
|
||||
secretKey: 'admin123',
|
||||
});
|
||||
|
||||
// const s3 = new AWS.S3({
|
||||
// accessKeyId: 'admin',
|
||||
// secretAccessKey: 'admin123',
|
||||
// endpoint: 'http://localhost:9000',
|
||||
// s3ForcePathStyle: true, // 使用路径样式的 URL
|
||||
// signatureVersion: 'v4',
|
||||
// });
|
||||
|
||||
// 监听事件
|
||||
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();
|
||||
|
||||
const getList = async () => {
|
||||
const res = minioClient.listObjectsV2('mark', 'common', true);
|
||||
res.on('data', (event) => {
|
||||
console.log(event);
|
||||
});
|
||||
};
|
||||
// getList();
|
||||
33
services/client-mark/tsconfig.json
Normal file
33
services/client-mark/tsconfig.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "nodenext",
|
||||
"target": "esnext",
|
||||
"noImplicitAny": false,
|
||||
"outDir": "./dist",
|
||||
"sourceMap": false,
|
||||
"allowJs": true,
|
||||
"newLine": "LF",
|
||||
"baseUrl": "./",
|
||||
"typeRoots": [
|
||||
"node_modules/@types",
|
||||
"node_modules/@kevisual/types"
|
||||
],
|
||||
"declaration": true,
|
||||
"noEmit": false,
|
||||
"allowImportingTsExtensions": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"moduleResolution": "NodeNext",
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"esModuleInterop": true,
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
],
|
||||
"exclude": [],
|
||||
}
|
||||
Reference in New Issue
Block a user