@sap-ux/i18n
Version:
Library for i18n
15 lines • 452 B
JavaScript
import { promises } from 'node:fs';
/**
* Read the entire contents of a file.
*
* @param filePath absolute path to a file.
* @param fs optional `mem-fs-editor` instance. If provided, `read` api of `mem-fs-editor` is used.
* @returns file content
*/
export async function readFile(filePath, fs) {
if (fs) {
return fs.read(filePath);
}
return promises.readFile(filePath, { encoding: 'utf8' });
}
//# sourceMappingURL=read.js.map