Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

computron

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

computron

Computron is a Node.js library to apply XSLT stylesheets to XML documents.

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32
increased by966.67%
Maintainers
2
Weekly downloads
 
Created
Source

Build and test status npm version

Computron

Computron is a Node.js library to apply XSLT stylesheets to XML documents. It's a C++ addon for Node.js that uses libxml2 and libxslt.

Disclaimer

This library is only intended to be used on Linux.

Requirements

You must have libxml2 and libxslt1 installed on your system.

sudo apt install libxml2-dev libxslt1-dev

You should already have a C++ compiler installed on your system, if it's not the case install g++.

sudo apt install g++

Computron uses node-gyp as a build system so you need to install it to be able to compile Computron

npm install -g node-gyp

Usage

Basic example:

const Computron = require('computron');
const computron = new Computron();

computron.loadStylesheet('/path/to/stylesheet', (_err) => {
  if (_err) throw _err;

  // null is passed as second argument because the stylesheet doesn't take any parameters
  computron.apply('/path/to/xml', null, (err, result) => {
    if (err) throw err;

    console.log(result);
  });
});

Using a stylesheet that takes parameters:

const Computron = require('computron');
const computron = new Computron();

computron.loadStylesheet('/path/to/stylesheet-with-params', (_err) => {
  if (_err) throw _err;

  computron.apply('/path/to/xml', { param1Name: 'param1Value', param2Name: 'param2Value' }, (err, result) => {
    if (err) throw err;

    console.log(result);
  });
});

Development

To build and run the tests in release mode run:

npm test

You can debug the C++ code with in VSCode, to do so run:

npm run build:config

This will build the VSCode debugger configuration, you can then simply press F5 or go to the "Run and Debug" tab and click on "Debug".

FAQs

Package last updated on 19 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc