19 lines
535 B
TypeScript
19 lines
535 B
TypeScript
import { minioClient } from '@/app.ts';
|
|
import { bucketName } from '@/modules/minio.ts';
|
|
|
|
import { router } from '../router.ts';
|
|
|
|
router.post('/api/minio', async (ctx) => {
|
|
let { username, appKey } = { username: '', appKey: '' };
|
|
const path = `${username}/${appKey}`;
|
|
const res = await minioClient.listObjectsV2(bucketName, path, true);
|
|
const file = res.filter((item) => item.isFile);
|
|
const fileList = file.map((item) => {
|
|
return {
|
|
name: item.name,
|
|
size: item.size,
|
|
};
|
|
});
|
|
// ctx.body = fileList;
|
|
});
|