A fast, regex-based XML minifier for Node.js (v4.5.2). Removes comments, collapses whitespace in tags, shortens unused namespace declarations, and collapses empty elements. Supports streaming for large files (>2 GiB). Ships TypeScript types. Lightweight alternative to pretty-data, with more aggressive tag-level minification. Released regularly on npm. Requires Node.js >=16.
npm install minify-xmlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: import default function, pass XML string, get minified XML with removed comments and collapsed whitespace.
Set `considerPreserveWhitespace: false` in options to minify even preserved whitespace elements.
Use `"strict"` to limit removal to tags only, if needed.
Set `removeUnusedNamespaces: false` to disable namespace manipulation.
Update to ESM imports: use `import` instead of `require()`.
Use programmatic import with options object for full control.
Switch to `import minifyXML from 'minify-xml'` and ensure `"type": "module"` in package.json, or upgrade to Node.js >=16.
Use `import minifyXML from 'minify-xml'` (default) or `import { minify } from 'minify-xml'`.Ensure all files use ES module syntax (`import`/`export`).
No dependency data recorded yet.