mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-09 18:56:11 +01:00
22 lines
487 B
TypeScript
22 lines
487 B
TypeScript
import { readFile } from 'fs/promises';
|
|
import { DATA_COMPRESSED } from '../../buildAssets/constants';
|
|
import { readDVPL } from './readDVPL';
|
|
|
|
export async function readDVPLFile(file: string) {
|
|
let path: string;
|
|
|
|
if (DATA_COMPRESSED) {
|
|
path = file.endsWith('.dvpl') ? file : `${file}.dvpl`;
|
|
} else {
|
|
path = file.replace('.dvpl', '');
|
|
}
|
|
|
|
const content = await readFile(path);
|
|
|
|
if (!DATA_COMPRESSED) return content;
|
|
|
|
const dvpl = readDVPL(content);
|
|
|
|
return dvpl;
|
|
}
|