brunner56's picture
implement app
0bfe2e3
raw
history blame contribute delete
444 Bytes
import fs from 'fs';
import path from 'path';
export class ResourceManager {
static getResource(resourceName: string) {
// check existence
const filePath = path.join(
__dirname,
'../../../../',
'resources',
resourceName
);
if (!fs.existsSync(filePath)) {
throw new Error(`Resource ${resourceName} not found at ${filePath}`);
}
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
}
}