MCPcopy Index your code
hub / github.com/commitizen/cz-cli / readConfigFileContent

Function readConfigFileContent

src/configLoader/getContent.js:73–82  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

71 * @return {String}
72 */
73function 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}

Callers 1

readConfigContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected