A Neon node extension that wraps the Rust bsdiff crate
npm install bsdiff-neonbsdiff-neon: A Neon node extension that wraps the Rust bsdiff crate
This project was bootstrapped by create-neon.
``javascript
const bsdiff = require("bsdiff-neon");
const crypto = require("crypto"); // for random values
const oldData = crypto.randomBytes(1024).buffer;
const newData = crypto.randomBytes(1024).buffer;
const diff = bsdiff.diff(oldData, newData);
const newRecovered = bsdiff.patch(oldData, diff, 1024);
`
Installing bsdiff-neon requires a supported version of Node and Rust.
You can install the project with npm. In the project directory, run:
`sh`
$ npm install
This fully installs the project, including installing any dependencies and running the build.
If you have already installed the project and only want to run the build, run:
`sh`
$ npm run build
This command uses the cargo-cp-artifact utility to run the Rust build and copy the built library into ./index.node`.
To learn more about Neon, see the Neon documentation.
To learn more about Rust, see the Rust documentation.
To learn more about Node, see the Node documentation.