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 🙏

© 2026 – Pkg Stats / Ryan Hefner

wcf2xml

v1.0.3

Published

Convert WCF-binary buffer to plain XML

Downloads

13

Readme

wcf2xml

Convert WCF-binary buffer to plain XML.

"WCF Binary" (aka ".NET Binary") is the binary packed format for WCF (Windows Communication Foundation), as described in this specification: MC-NBFX. (PDF file from microsoft.com)

Usually You meet WCF-binary data when communicating with SOAP servers, configured to pack their answers to binary form. Actually WCF-binary contains an XML document, and wcf2xml package allows your node.js application to convert the Buffer of binary data received from server to plain XML.

Example of WCF-binary packed data:

data-image

Will be decoded to this XML text:

<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
  <s:Header>
    <a:Action s:mustUnderstand="1">action</a:Action>
  </s:Header>
  <s:Body>
    <Inventory>0</Inventory>
  </s:Body>
</s:Envelope>

Installation

$ npm install wcf2xml

API

var w2x = require('wcf2xml');
var buf = ... // Buffer of data received from server or read from file
var xml = w2x.decode(buf);  // decoded XML in String

You receive XML as String to your local variable xml.

decode(buffer, [indent], [linefeed])

Parameter buffer gets the Buffer object containing binary data.

Optional parameter indent has default value " " (two spaces). It is used to indent nested XML elements.

Optional parameter linefeed has default value "\r\n" (CR-LF in Windows' style). It is used to divide child elements inside parent, and also parent's start and finish tags.

If You want, for example, retrieve single-line XML text without any indenting or dividing, pass "" to both optional parameters.

Tests

Package contains mocha test.js unit in test folder.

If You want to contribute the package, use this command to run tests (You will need mocha installed):

$ npm test

TODO

function encode()

It seems logical to add some encode() function to encode an XML to binary format. But I have 2 problems with this:

  1. I do not need such a functionality right now.

  2. Generally plain XML doesn't contain enough information for monosemantic encoding, e.g. <data>123</data> can mean Int8 data, Int16, Int32, Int64, UInt64, Chars8, Bytes8 etc. My very first idea is to use some additional marks, e.g. <data>[Int16]123</data>, but it is not as beautiful solution as I would like to see. If You have any better ideas, You are welcome.

test coverage

It would be great to cover function decode() with full set of tests, including all border conditions for all record types.

License

ISC