Last active
March 14, 2023 10:14
-
-
Save luismendes070/9159064d4e6ccc6b9bb2c3ceacde2b95 to your computer and use it in GitHub Desktop.
TypesScript programming language XML file reader XML file writer feature #ChatGPT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from 'fs'; | |
import * as xml2js from 'xml2js'; | |
// Read the XML file | |
const xml = fs.readFileSync('file.xml', 'utf-8'); | |
// Convert the XML to a JavaScript object | |
xml2js.parseString(xml, (err, result) => { | |
if (err) { | |
console.error(err); | |
return; | |
} | |
// Do something with the result object | |
console.log(result); | |
}); |
Author
luismendes070
commented
Mar 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment