import xml2js from 'xml2js'; import {readFileSync} from "fs"; const xml = "\n" + "\n" + " \n" + " \n" + " \n" + "" xml2js.parseStringPromise(xml).then(svgResult => { const svg = svgResult.svg const builder = new xml2js.Builder(); console.log(builder.buildObject(svg)) })