Spaces:
Build error
Build error
File size: 444 Bytes
0bfe2e3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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'));
}
}
|