Improved examples code

This commit is contained in:
Alexander Cerutti
2025-01-17 23:09:17 +01:00
parent e1975ad923
commit d5b3bba782
2 changed files with 5 additions and 5 deletions

View File

@@ -32,11 +32,11 @@ export function removeHidden(from: Array<string>): Array<string> {
async function readFileOrDirectory(filePath: string) {
if ((await fs.lstat(filePath)).isDirectory()) {
return Promise.all(await readDirectory(filePath));
} else {
return fs
.readFile(filePath)
.then((content) => getObjectFromModelFile(filePath, content, 1));
}
const fileBuffer = await fs.readFile(filePath);
return getObjectFromModelFile(filePath, fileBuffer, 1);
}
/**

View File

@@ -26,7 +26,7 @@ app.route("/scratch/:modelName").get(async (request, response) => {
"../../models/exampleBooking.pass/icon.png",
),
),
await getCertificates(),
getCertificates(),
]);
try {