开发者社区> 镜像站> NPM> xor-stream
xor-stream
Take two readable streams and return a readable stream with the xor of the two input chunks
Last updated 5 years ago by bret .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install xor-stream 
SYNC missed versions from official npm registry.

xor-stream

Take two readable streams and return a readable stream that contains chunkB XOR chunkB

npm install xor-stream

Build Status

This can be used to calculate pairty blobs of the contents of two streams.

Example

var xorStream = require('xor-stream')
var streamEqual = require('stream-equal')
var rs = require('fs').createReadStream

var pairty = xorStream(rs('pathA'), rs('pathB'))
var contentOfA = xorStream(pairty, rs('pathB'))

streamEqual(rs('pathA'), contentOfA, function (err, equal) {
  console.log(equal) // true if file A is larger than File B
})

Right now, if one file is longer than the other, xor-stream pads the shorter stream with 0 bytes, so recovering shorter files from the longer file XOR pairty will have extra byte padding at the end.

Background

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (6)
Dependents (0)
None