npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

catenate-xml

v1.0.0

Published

Concatenate xml files by extracting the elements selected by an Xpath expression from each of file in a list and appending them as children of the specified element of the supplied template. Default configuration is suitable for combining kml files from a

Readme

Catenate XML

A Node.js tool for catenating the sub-elements of a XML documents into a single-well formed document.

Motivation

When Google changed the timeline feature, we had the option of downloading our travel history. Google allowed downloading summary data in batch, but the details were only available to download through the web UI. Fortunately, I found instructions to download KML files for each day of one's timeline. Having each day in a file is helpful, but I want to view my history, so I looked for a way to view all the KML files (one from each day in my timeline).

I didn't find any tools that will easily browse the series of files that represents my timeline, so I thought it would be easy to combine all the files into one. I'd forgotten about the intracacies of XML. I searched for some time for a tool that would simply extract specific elements from a list of files and catenate them into a single file. A bit of coding around XSLT would have been an option, but I decided to make a tool that would be easy to use by folks that want to create one KML file to represent (a piece of) their history.

Purpose

This tool can be configured to combine the selected elements of any well-formed XML files. The default configuration works with KML files.

Installation

The tool can be installed via NPM

npm install catenate-xml

Usage

The command-line parameters provide the list of files to catenate. If they are KML files, there shouldn't be any need for additional configuration.

npm exec catenate-xml <list of files>

Instant execution

The npx command allows the tool to be downloaded and executed in one step.

npx catenate-xml <list of files>

Configuration

Configuration options are provided in the values of environment variables. Please invoke the tool with no arguments to see a description of all configuration options.

In (most) Linux shells, environment varibles can be specified for an individual command like so:

CATENATE_TARGET_PARENT=//ListElements npx catenate-xml

As a module

After installation, the DocumentCollector class is instantiated with the XSL expression that specifies the element(s) that should be extracted from each source file and the maximum number of files to open concurrently.

const collector = new DocumentCollector("//InterestingElementTag", 5);

The instance must then load the document shell that will receive the child elements extracted from the inputs. The location in the document where the extracted elements will be inserted as children is the other parameter. await collector.loadShellDocument("./template.xml", "//FutureParentOfCatenatedFileContents");

Now the input files can be ingested. The order of the children is the order of the files listed, similar to using cat to catenate the files.

await collector.ingestFiles(argv.slice(2));

After ingesting the files, use the instance's doc property to serialize the result to XML.

new XMLSerializer().serializeToString(collector.doc)

Dependencies

The dependencies selected seem to be fairly minimal and seemed to be the most-used JavaScript-based XML processors. Please add an issue on GitHub if you're aware of better XML, please open an issue on GitHub (and maybe a PR with a working replacement).