+function handleError (err: any) {
+ console.error(err)
+ process.exit(-1)
+}
+
+function xliffFile2JSON (filePath: string, cb) {
+ const fileTarget = filePath.replace('.xml', '.json')
+
+ // Remove the two first lines our xliff module does not like
+ let fileContent = readFileSync(filePath).toString()
+ fileContent = removeFirstLine(fileContent)
+ fileContent = removeFirstLine(fileContent)
+
+ xliff12ToJs(fileContent, (err, res) => {
+ if (err) return cb(err)
+
+ const json = createJSONString(res)
+ writeFile(fileTarget, json, err => {
+ if (err) return cb(err)
+
+ return unlink(filePath, cb)
+ })
+ })
+}
+