stream-teleport
v1.0.4
Published
Send big files or chunks of data over a stream
Downloads
4
Readme
stream-teleport
Send big files or chunks of data over a stream. Useful to overcome WebRTC data channel message size limit.
Installation
npm install -S stream-teleport
Usage
Use .dematerialize
to break a chunk into smaller chunks. Then on the other end use .rematerialize
to reassemble it.
Example sending a big file over WebRTC and simple-peer lib:
// On sender machine
const dematerializeStream = streamTeleport.dematerialize({ chunkSize: 1024 })
const fileStream = fs.createReadStream('massive-video.mp4')
fileStream.pipe(dematerializeStream).pipe(peer)
// On receiver machine
const rematerializeStream = streamTeleport.rematerialize()
const fileStream = fs.createWriteStream('massive-video.mp4')
peer.pipe(rematerializeStream).pipe(fileStream)
caiogondim.com · GitHub @caiogondim · Twitter @caio_gondim