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