Fix: indents
This commit is contained in:
4
index.ts
4
index.ts
@@ -10,8 +10,8 @@ async function loadPages(): Promise<void> {
|
||||
try {
|
||||
const pagesPath = path.join(__dirname, './pages');
|
||||
const pagesFiles = path.basename(__filename).endsWith('.ts')
|
||||
? (await readdir(pagesPath)).filter(file => file.endsWith('.ts'))
|
||||
: (await readdir(pagesPath)).filter(file => file.endsWith('.js'));
|
||||
? (await readdir(pagesPath)).filter(file => file.endsWith('.ts'))
|
||||
: (await readdir(pagesPath)).filter(file => file.endsWith('.js'));
|
||||
for (const file of pagesFiles) {
|
||||
const filePath = path.join(pagesPath, file);
|
||||
const data = await import(filePath);
|
||||
|
||||
@@ -29,14 +29,14 @@ class Repo extends Page{
|
||||
res.set({
|
||||
'Content-Type': 'application/octet-stream'
|
||||
});
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
fileStream.pipe(res);
|
||||
fileStream.on('end', () => {
|
||||
console.log(`Response with ${file}`);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
} catch(err: unknown) {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
fileStream.pipe(res);
|
||||
fileStream.on('end', () => {
|
||||
console.log(`Response with ${file}`);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
} catch(err: unknown) {
|
||||
if (err instanceof URIError) {
|
||||
res.status(404).send(String(err));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user