New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lswbxml

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lswbxml

lswbxml

  • 0.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

lswbxml

Fast streaming WBXML parser and generator for Node.js.

Installation

With npm:

npm install lswbxml

Parsing WBXML

LiveScript:

require! fs
wbxml = require \lswbxml

# With streams
file = fs.create-read-stream 'example.wbxml'
<-! file.on \open
wbxml.decode file, language: \ActiveSync, !(err, obj)->
  throw err if err
  console.log 'Parsed WBXML:'
  console.log obj

# With buffers (synchronous)
buf = fs.read-file-sync 'example.wbxml'
obj = wbxml.decode-sync buf, language: \ActiveSync
console.log 'Parsed WBXML:'
console.log obj

CoffeeScript:

fs = require 'fs'
wbxml = require 'lswbxml'

# With streams
file = fs.createReadStream 'example.wbxml'
file.on 'open', ->
  wbxml.decode file, language: 'ActiveSync', (err, obj)->
    throw err if err
    console.log 'Parsed WBXML:'
    console.log obj

# With buffers (synchronous)
buf = fs.readFileSync 'example.wbxml'
obj = wbxml.decodeSync buf, language: 'ActiveSync'
console.log 'Parsed WBXML:'
console.log obj

JavaScript

fs = require('fs');
wbxml = require('lswbxml');

// With streams
file = fs.createReadStream('example.wbxml');
file.on('open', function() {
  wbxml.decode(file, {language: 'ActiveSync'}, function(err, obj) {
    if (err) {
      throw err;
    }
    console.log('Parsed WBXML:');
    console.log(obj);
  });
});

// With buffers (synchronous)
buf = fs.readFileSync('example.wbxml');
obj = wbxml.decodeSync(buf, {language: 'ActiveSync'});
console.log('Parsed WBXML:');
console.log(obj);

Parsing WBXML stream

LiveScript:

require! fs
wbxml = require \lswbxml

file = fs.create-read-stream 'example.wbxml'
<-! file.on \open
obj = null
decoder = new wbxml.Decoder language: \ActiveSync
  ..on \error !->
    throw it
  ..on \readable !->
    obj := decoder.read!
  ..on \end !->
    throw Error("Incomplete WBXML stream") if not obj?
    console.log 'Parsed WBXML:'
    console.log obj
file.pipe decoder

CoffeeScript:

fs = require 'fs'
wbxml = require 'lswbxml'

file = fs.createReadStream 'example.wbxml'
file.on 'open', ->
  obj = null
  decoder = new wbxml.Decoder language: 'ActiveSync'
  decoder.on 'error', (err)->
      throw err
  decoder.on 'readable', ->
      obj = decoder.read()
  decoder.on 'end', ->
      throw Error("Incomplete WBXML stream") if obj is null
      console.log 'Parsed WBXML:'
      console.log obj
  file.pipe decoder

JavaScript:

fs = require('fs');
wbxml = require('lswbxml');

file = fs.createReadStream('example.wbxml');
file.on('open', function() {
  var obj = null;
  decoder = new wbxml.Decoder({language: 'ActiveSync'});
  decoder.on('error', function(err) {
    throw err;
  });
  decoder.on('readable', function() {
    obj = decoder.read();
  });
  decoder.on('end', function() {
    if (obj === null) {
      throw Error('Incomplete WBXML stream');
    }
    console.log('Parsed WBXML:');
    console.log(obj);
  });
  file.pipe(decoder);
});

Building from source

Install gulp with:

npm install -g gulp

And run:

gulp build

or:

gulp watch

for continuous integration.

Testing

Run:

gulp test

FAQs

Package last updated on 26 Mar 2014

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