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 🙏

© 2024 – Pkg Stats / Ryan Hefner

node1-libxmljsmt-myh

v1.0.8

Published

multi-threaded libxml bindings for v8 javascript engine

Downloads

5,409

Readme

Libxmljs-mt

Build Status

AppVeyor Build Status

This project is a fork of libxmljs. The current version 0.18.3 is based on libxmljs 0.18.7 and libxml 2.9.4.

Libxmljs was originally designed with single-threaded operations in mind. There are no asynchroneous operations for things like parsing XML documents. But even more importantly, since the embedded libxml was configured only for single-threaded use, no other package could build on this to provide multi-threaded operations using libxml. The issue is discussed at length in upstream issue 296.

This package here adds multi-threading support to libxmljs. It does offer a method to asynchroneously parse an XML file using

libxmljs.fromXmlAsync(buffer, options, function callback(err, doc) {…});

and it can be used by other packages to provide more advanced asynchroneous operations. To do so, the code has to construct a libxmljs::WorkerParent object on the V8 thread and then a libxmljs::WorkerSentinel on the worker thread. Both of these are RAII sentinels, so they do some setup in their constructor and some cleaning up in their destructor. Getting their lifetime right is important. When using nan, it's easiest to make the WorkerParent a member of the class derived from NanAsyncWorker and have a WorkerSentinel variable in the Execute method of that class.

It is to be hoped that this fork is a temporary solution, and that the original libxmljs project will adapt either this solution or a similar one to become usable in a multi-threaded way. But the corresponding bug report has remained open for too long, and even though there was some very valuable discussion going on, there were also long spans with no activity at all. It is hard to tell when this fork will become obsolete, if ever.

Note that this project makes use of a git submodule for the libxml code, so if you are building from a git checkout you might have to perform git submodule update --init before you can do npm install.

Below comes the documentation from the original project, with only slight modifications where appropriate.


Libxmljs

LibXML bindings for node.js

var libxmljs = require("libxmljs-mt");
var xml =  '<?xml version="1.0" encoding="UTF-8"?>' +
           '<root>' +
               '<child foo="bar">' +
                   '<grandchild baz="fizbuzz">grandchild content</grandchild>' +
               '</child>' +
               '<sibling>with content!</sibling>' +
           '</root>';

var xmlDoc = libxmljs.parseXml(xml);

// xpath queries
var gchild = xmlDoc.get('//grandchild');

console.log(gchild.text());  // prints "grandchild content"

var children = xmlDoc.root().childNodes();
var child = children[0];

console.log(child.attr('foo').value()); // prints "bar"

Support

API and Examples

Check out the wiki http://github.com/libxmljs/libxmljs/wiki.

See the examples folder.

Installation via npm

npm install libxmljs-mt

Contribute

Start by checking out the open issues both for the upstream project and the multi-threaded fork. Specifically the desired feature ones.

Requirements

Make sure you have met the requirements for node-gyp. You do not need to manually install node-gyp; it comes bundled with node.