@jordanebachelet/xml-split

1.1.4 • Public • Published

XML Split

Coverage Status NPM version

Installation

  • Go to the directory where you cloned the repository.
  • Run npm install @jordanebachelet/xml-split.

How to use

Through command line interface

You can run the npm link command before using this tool. This will allows you to directly run the xmlsplit command in your command line.

Then, you can run the following commands:

# without npm link
node bin/cli.js split path/to/big/xml/file.xml "child_node" -s 10 -p ".part_" -c 0

# with npm link
xmlsplit split path/to/big/xml/file.xml "child_node" -s 10 -p ".part_" -c 0

This command will split the given XML file into chunks of 10 Mb files, renamed as file.part_0.xml, file.part_1.xml, file.part_2.xml ...

Through the Javascript interface

You can use this tool directly in your NodeJS scripts.

The split method returns a native Promise so you can do some work after the method.

Hereafter how to integrate this tool in your scripts:

const xmlSplit = require('xml-split');

xmlSplit.split('path/to/big/xml/file.xml', 'child_node', {
    size: 10,
    pattern: '.part_',
    counter: 0
}).then(() => {
    console.log('split complete');
});

API Reference

Please check the docs folder here.

Package Sidebar

Install

npm i @jordanebachelet/xml-split

Weekly Downloads

1

Version

1.1.4

License

MIT

Unpacked Size

1.16 MB

Total Files

33

Last publish

Collaborators

  • jordanebachelet