* Read proper content from config file. * If the chartset of the config file is not utf-8, one error will be thrown. * @param {String} configPath * @return {String}
(configPath)
| 71 | * @return {String} |
| 72 | */ |
| 73 | function readConfigFileContent (configPath) { |
| 74 | |
| 75 | let rawBufContent = fs.readFileSync(configPath); |
| 76 | |
| 77 | if (!isUTF8(rawBufContent)) { |
| 78 | throw new Error(`The config file at "${configPath}" contains invalid charset, expect utf8`); |
| 79 | } |
| 80 | |
| 81 | return stripBom(rawBufContent.toString("utf8")); |
| 82 | } |