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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wbxml

v0.0.1

Published

Javascript encoder/decoder for WAP Binary XML Content Format. See www.w3.org/TR/wbxml for spec.

Downloads

87

Readme

wbxml

Javascript encoder/decoder for WAP Binary XML Content Format.

Motivation

WAP Binary XML (WBXML) is a binary representation of XML. WBXML is used as a compact transmission format for mobile clients, which typically have little memory and bandwidth. The specification for WBXML is maintained by W3C.

This module can both encode and decode a wbxml Stream.

Usage

Install using npm. wbxml's only dependency is readable-stream. This is just for node 0.8.x support - it will probably be removed at some point.

   [sudo] npm install wbxml

Now just include in your project

   var wbxml = require('wbxml')

Currently there are two objects

  • Decoder: Encodes objects as WBXML string.
  • Encoder: Decodes input string to Javascript object.

Say you have some XML that looks like this:

<people>
  <person>
    <name>Andrew</name>
  </person>
  <person>
    <name>Jenni</name>
    <place>San Francisco</place>
  <person>
</people>

Say you wanted to encode the XML as WBXML. First, you will need to define the codepages - for example:

var codepages = [
  // Code Page 0: people
  {
    0x01: 'person'
  },
  // Code Page 1: person
  {
    0x01: 'name',
    0x02: 'place',
  }
]

codepages is an Array of objects. The indexes define the codepage, then the properties of each object define the token.

Second, you will need to define the namespaces that go with the codepage. This is simply an Array of strings in the same order as the code pages they represent.

var namespaces = [
  // Code Page 0: people
  'people',
  // Code Page 1: person
];

Now you can create an object to represent your xml (xml is not directly supported yet as either an input or output). Javascript objects don't support multiple properties with the same name. So since our element can contain multiple elements, we use an array for those. This is a bit tricky - you have to remember that all the objects in the person array are implicitly person objects. The object we need to create looks like this:

var people = {
  person: [
    {
      name: 'Andrew'
    },
    {
      name: 'Jenni',
      place: 'San Francisco'
    }
  ]
};

Now you can do this:

// Both codepages and namespaces are required
var encoder = new wbxml.Encoder ({ codepages: codepages, namespaces: namespaces });
encoder.write(people);
var result = encoder.read();

// No namespaces for the decoder
var decoder = new wbxml.Decoder ({ codepages: codepages });
decoder.write(result);
result = decoder.read()
// result now same as people

Codepage

The codepage must be provided as an array of objects. The index of each object determines the codepage number. Each object contains key-value where key is an octal tag id and value is a string.

Progress

This is a first pass and only implements:

  • WBXML tokens to encode XML tags
  • WBXML code pages to support multiple XML namespaces
  • Inline strings
  • Opaque data

The following features are not yet implemented:

In addition, the following things

  • Decoder: Needs options to always return namespace-prefixed property names
  • Encoder: Ignore properties that don't belong
  • Combine codepages and namespaces into a single input
  • Streaming xml into the encoder
  • Streaming xml from the decoder (i.e. with events)
  • More tests
  • There are a few code TODOs and opportunities for performance improvements

Resources

https://libwbxml.opensync.org/ http://kxml.sourceforge.net/

Author: Andrew Dalgleish

License: BSD