@esposter/xml2js
v2.24.0
Published
Simple XML to JavaScript object converter.
Readme
@esposter/xml2js
Inspired by xml2js.
A complete rewrite from CoffeeScript to TypeScript that removes unnecessary dependencies like events — resolving issues such as this.removeAllListeners is not a function. Retains all the options and behaviour of the original xml2js. Use parseStringPromise as the primary parsing API.
Table of Contents
🚀 Getting Started
pnpm i @esposter/xml2js📖 Documentation
We highly recommend you take a look at the documentation to level up.
Usage
import { parseStringPromise } from "@esposter/xml2js";
const xml = `<root><child attr="value">text</child></root>`;
const result = await parseStringPromise(xml);
// result: { root: { child: [ { _: 'text', $: { attr: 'value' } } ] } }Why Not the Original xml2js?
The original package pulls in the events module which causes runtime errors in certain bundler/edge environments. This rewrite is a drop-in replacement that works cleanly in Node.js, Azure Functions, and browser bundles.
⚖️ License
This project is licensed under the Apache-2.0 license.
