2023-12-09 15:56:25 -06:00
|
|
|
import { readFile } from 'fs/promises';
|
2025-06-05 13:01:50 -05:00
|
|
|
import { DATA_COMPRESSED } from '../../buildAssets/constants';
|
2023-12-09 15:56:25 -06:00
|
|
|
import { readDVPL } from './readDVPL';
|
|
|
|
|
|
|
|
|
|
export async function readDVPLFile(file: string) {
|
2025-06-05 13:01:50 -05:00
|
|
|
let path: string;
|
|
|
|
|
|
|
|
|
|
if (DATA_COMPRESSED) {
|
|
|
|
|
path = file.endsWith('.dvpl') ? file : `${file}.dvpl`;
|
|
|
|
|
} else {
|
|
|
|
|
path = file.replace('.dvpl', '');
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-05 02:07:35 +00:00
|
|
|
const content = await readFile(path);
|
2025-06-05 13:01:50 -05:00
|
|
|
|
|
|
|
|
if (!DATA_COMPRESSED) return content;
|
|
|
|
|
|
2025-04-05 02:07:35 +00:00
|
|
|
const dvpl = readDVPL(content);
|
2025-01-14 19:22:41 -06:00
|
|
|
|
2025-04-05 02:07:35 +00:00
|
|
|
return dvpl;
|
2023-12-09 15:56:25 -06:00
|
|
|
}
|