Node Roundup: 0.8.9, xmlson, Mubsub, Book on libuv
Node 0.8.9
Node 0.8.9 is out, and this looks like a significant release judging by the long changelog. v8, npm, and GYP have all been updated, and there are quite a few platform-specific bug fixes relating to memory.
xmlson
xmlson (License: MIT, npm: xmlson) by the developers at Fractal is a libexpat-based XML/JSON conversion module:
var xmlson = require('xmlson');
xmlson.toJSON('<p><h1 title="Details">Title</h1></p>', function(err, obj) {
// Do something with obj
console.log(obj.p.h1)
});
In the previous example, [ { '@title': 'Details', text: 'Title' } ] will be printed, so attributes are included when converting to JSON. There’s also a synchronous API. Installing xmlson with npm will compile the necessary dependencies with gyp.
This module is a fairly lightweight wrapper around ltx, which is worth checking out.
Mubsub
Mubsub (License: MIT, npm: mubsub) by Scott Nelson is a publish–subscribe implementation that uses MongoDB:
It utilizes Mongo’s capped collections and tailable cursors to notify subscribers of inserted documents that match a given query.
To use it, a channel must be created and then subscribed to. It can work with MongoDB connection URLs, so it’s fairly easy to drop into an existing MongoDB-based Node project. It comes with Mocha/Sinon.JS tests.
Book: An Introduction to libuv
An Introduction to libuv by Nikhil Marathe is a guide to libuv. It covers streams, threads, processes, event loops, and utilities. If you’re trying to understand what makes Node different, and how its asynchronous and event-based design works, then this is actually a great guide. Try looking at Basics of libuv: Event loops as an example.
