mirror of
https://github.com/spacebarchat/server.git
synced 2026-03-30 20:25:40 +00:00
more async io
This commit is contained in:
@@ -30,7 +30,7 @@ router.get(
|
||||
},
|
||||
},
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
(req: Request, res: Response) => {
|
||||
const config = ConnectionConfig.get();
|
||||
|
||||
Object.keys(config).forEach((key) => {
|
||||
|
||||
@@ -46,12 +46,12 @@ const router = Router({ mergeParams: true });
|
||||
|
||||
async function getFile(path: string) {
|
||||
try {
|
||||
return fs.readFile(path);
|
||||
return await fs.readFile(path);
|
||||
} catch (error) {
|
||||
try {
|
||||
const files = await fs.readdir(path);
|
||||
if (!files.length) return null;
|
||||
return fs.readFile(join(path, files[0]));
|
||||
return await fs.readFile(join(path, files[0]));
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user