virool-pivot
Version:
A web-based exploratory visualization UI for Druid.io
14 lines (11 loc) • 369 B
text/typescript
import * as fs from 'fs';
import * as yaml from 'js-yaml';
export function loadFileSync(filepath: string, postProcess: string = null): any {
var fileData = fs.readFileSync(filepath, 'utf-8');
if (postProcess === 'json') {
fileData = JSON.parse(fileData);
} else if (postProcess === 'yaml') {
fileData = yaml.safeLoad(fileData);
}
return fileData;
}