Skip to content

Take two readable streams and return a readable stream with the xor of the two input chunks

License

Notifications You must be signed in to change notification settings

bcomnes/xor-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xor-stream

Take two readable streams and return a readable stream that contains chunkA 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 pairity = xorStream(rs('pathA'), rs('pathB'))
var contentOfA = xorStream(pairity, 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

About

Take two readable streams and return a readable stream with the xor of the two input chunks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published