@ably/vcdiff-decoder
Advanced tools
Comparing version 1.0.2 to 1.0.3
'use strict'; | ||
const errors = require('./errors'); | ||
const VCDiff = require('./vcdiff'); | ||
/** | ||
* | ||
* @param delta {Uint8Array} | ||
* @param source {Uint8Array} | ||
* Vcdiff decode, applying delta to source and returning the result. | ||
* | ||
* @param delta {Uint8Array} The Vcdiff format diff/patch to apply to source. | ||
* @param source {Uint8Array} The source to apply the delta diff/patch to. | ||
* @returns {Uint8Array} The result of applying delta to source. | ||
*/ | ||
function decodeSync(delta, source) { | ||
function decode(delta, source) { | ||
let vcdiff = new VCDiff(delta, source); | ||
@@ -15,11 +17,4 @@ return vcdiff.decode(); | ||
function decode(delta, buffer) { | ||
} | ||
module.exports = { | ||
decodeSync, | ||
decode | ||
}; | ||
{ | ||
"name": "@ably/vcdiff-decoder", | ||
"version": "1.0.2", | ||
"description": "Pure JavaScript vcdiff decoder that works with binary deltas from Google's open-vcdiff", | ||
"version": "1.0.3", | ||
"description": "Pure JavaScript Vcdiff decoder that works with binary deltas from Google's open-vcdiff", | ||
"license": "Apache-2.0", | ||
"homepage": "https://ably.io/", | ||
"main": "lib/vcdiff_decoder.js", | ||
"scripts": { | ||
"grunt": "./node_modules/grunt-cli/bin/grunt", | ||
"test": "./node_modules/grunt-cli/bin/grunt test:all" | ||
"grunt": "grunt", | ||
"test": "grunt test:all" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ably-forks/vcdiff-decoder.git" | ||
}, | ||
"repository": "ably-forks/vcdiff-decoder.git", | ||
"keywords": [ | ||
"sdch", | ||
"delta", | ||
"cache", | ||
"decoding", | ||
"compression" | ||
"decoder", | ||
"compression", | ||
"Vcdiff", | ||
"diff" | ||
], | ||
"author": "William MacDonald", | ||
"author": "Ably Real-time Ltd <support@ably.io>", | ||
"contributors": [ | ||
"William MacDonald", | ||
"Tsviatko Yovtchev <tsviatko@codemerx.com> (https://codemerx.com)" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
@@ -39,4 +39,4 @@ "url": "https://github.com/ably-forks/vcdiff-decoder/issues" | ||
"grunt": "^1.1.0", | ||
"grunt-bump": "^0.8.0", | ||
"grunt-cli": "^1.3.2", | ||
"grunt-bump": "^0.8.0", | ||
"grunt-karma": "^3.0.2", | ||
@@ -52,8 +52,7 @@ "grunt-mocha-test": "^0.13.3", | ||
"karma-webpack": "^4.0.2", | ||
"mocha": "^3.0.2", | ||
"mocha": "^7.1.2", | ||
"vcdiff": "baranov1ch/node-vcdiff", | ||
"webpack": "^4.42.1", | ||
"webpack-cli": "^3.3.11" | ||
}, | ||
"homepage": "https://github.com/ably-forks/vcdiff-decoder" | ||
} | ||
} |
@@ -18,3 +18,3 @@ # Vcdiff Decoder | ||
let target = vcdiff.decodeSync(deltaBuffer, new Buffer('some dictionary string buffer')); | ||
let target = vcdiff.decode(deltaBuffer, new Buffer('some dictionary string buffer')); | ||
console.log(target.toString()); | ||
@@ -25,18 +25,11 @@ ``` | ||
### `decodeSync(delta, source)` | ||
### `decode(delta, source)` | ||
Synchronous decode. Parameters: | ||
* `delta`: [`Buffer`](https://nodejs.org/api/buffer.html) - the binary Vcdiff format encoding of the patch/diff information needed to transform `source` to the returned target | ||
* `source`: [`Buffer`](https://nodejs.org/api/buffer.html) - the group of bytes to transform to the returned target using by applying `delta` | ||
* `delta`: [`Uint8Array`](https://nodejs.org/api/buffer.html) - the binary Vcdiff format encoding of the patch/diff information needed to transform `source` to the returned target | ||
* `source`: [`Uint8Array`](https://nodejs.org/api/buffer.html) - 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`. | ||
Returns a `Uint8Array`, 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`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that either resolves with the target [`Buffer`](https://nodejs.org/api/buffer.html) or rejects with an error. | ||
## Contributing | ||
@@ -62,5 +55,13 @@ | ||
### Building | ||
You can trigger a build using Webpack with: | ||
npm run grunt -- build | ||
which creates `vcdiff-decoder.js` and `vcdiff-decoder.min.js` in a folder called `dist`. | ||
### Testing | ||
To run all tests use | ||
To run all tests use: | ||
@@ -75,6 +76,10 @@ npm test | ||
## Release checklist | ||
## Release Procedure | ||
1. Run `npm run grunt -- release:patch` (or "major", "minor" or "prepatch" as appropriate - see [grunt-bump Usage Examples](https://github.com/vojtajina/grunt-bump#usage-examples)) | ||
2. Run `npm run grunt -- release:deploy` | ||
3. Visit [tags](https://github.com/ably-forks/vcdiff-decoder/tags) and draft new release for the newly created tag | ||
On the `master` branch: | ||
1. Increment the version, regenerate from source (a.k.a. build / bundle) and make a tagged commit which includes the built output from the `/dist` folder by running `npm run grunt -- release:patch` (or "major", "minor" or "prepatch" as appropriate - see [grunt-bump Usage Examples](https://github.com/vojtajina/grunt-bump#usage-examples)) | ||
2. Release the tagged commit to Github using `git push origin master --follow-tags` | ||
3. Release to NPM using `npm publish . --access public` ([this package](https://www.npmjs.com/package/@ably/vcdiff-decoder) is configured to require that [2FA](https://docs.npmjs.com/configuring-two-factor-authentication) is used by publishers) | ||
4. Release to Ably's CDN using `npm run grunt -- publish-cdn` (operable by Ably staff only) | ||
5. Visit [tags](https://github.com/ably-forks/vcdiff-decoder/tags) and draft new release for the newly created tag |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
27175
82
0
569