JSPM

@ably/vcdiff-decoder

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21571
  • Score
    100M100P100Q169969F
  • License MIT

Pure JavaScript vcdiff decoder that works with binary deltas from Google's open-vcdiff

Package Exports

  • @ably/vcdiff-decoder

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ably/vcdiff-decoder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Vcdiff Decoder

Build Status npm version

A Vcdiff decoder written in pure JavaScript. Supports the Vcdiff format, as specified in RFC 3284.

Tested and proven with Vcdiff patch/delta files generated from Google's open-vcdiff and Joshua MacDonald's xdelta.

Usage

const vcdiff = require('@ably/vcdiff-decoder');

let target = vcdiff.decodeSync(deltaBuffer, new Buffer('some dictionary string buffer'));
console.log(target.toString());

Exported Functions

decodeSync(delta, source)

Synchronous decode. Parameters:

  • delta: Buffer - the binary Vcdiff format encoding of the patch/diff information needed to transform source to the returned target
  • source: Buffer - the group of bytes to transform to the returned target using by applying delta

Returns a Buffer, the 'target', being the result of applying delta to source.

decode(delta, source)

Asynchronous decode.

The input parameters for this function are the same as for the synchronous function decodeSync(delta, source). The difference is that this function returns a Promise that either resolves with the target Buffer or rejects with an error.

Contributing

Requirements

The vcdiff dev dependency of this project, used for testing, fails to build against Node.js 9 and newer. For this reason, until #3 has been addressed, the tests must be run against an environment with Node.js 8 installed.

At the time of writing this means:

vcdiff-decoder % node --version
v8.17.0
vcdiff-decoder % npm --version
6.13.4

For those who use ASDF or compatible tooling to manage their Node.js runtime versions, we have included a .tool-versions file.

Testing

To run all tests use

npm test

Browser testing supported by

for which you will need to configure environment variables for BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESSKEY.

Release checklist

  1. Run npm run grunt -- release:patch (or "major", "minor" or "prepatch" as appropriate - see grunt-bump Usage Examples)
  2. Run npm run grunt -- release:deploy
  3. Visit tags and draft new release for the newly created tag