Socket
Socket
Sign inDemoInstall

@ably/vcdiff-decoder

Package Overview
Dependencies
0
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ably/vcdiff-decoder

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


Version published
Weekly downloads
935
increased by8.09%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 17 Apr 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc