JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 95
  • Score
    100M100P100Q74918F
  • License MIT

A Node.js wrapper for the diffx CLI tool - structured diffing of JSON, YAML, TOML, XML, INI, and CSV files.

Package Exports

  • diffx-js
  • diffx-js/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (diffx-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

diffx-js

A Node.js wrapper for the diffx CLI tool.

Installation

npm install diffx-js

This will automatically download the appropriate diffx binary for your system from GitHub Releases.

Usage

const { runDiffx } = require('diffx-js');

async function main() {
  // Compare two JSON files
  let result = await runDiffx(["file1.json", "file2.json"]);

  if (result.code === 0) {
    console.log("No differences found.");
  } else {
    console.log("Differences found:");
    console.log(result.stdout);
  }

  // You can pass any arguments supported by the diffx CLI
  result = await runDiffx(["file1.yaml", "file2.yaml", "--output", "json"]);
  console.log(result.stdout);
}

main();

Development

To link for local development:

npm link

License

This project is licensed under the MIT License.