mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 14:15:06 +01:00
4f0a205369
* Use eslint@6.8.0 * yarn lint:fix
23 lines
477 B
JavaScript
23 lines
477 B
JavaScript
import ObjectMultiplex from 'obj-multiplex'
|
|
import pump from 'pump'
|
|
|
|
/**
|
|
* Sets up stream multiplexing for the given stream
|
|
* @param {any} connectionStream - the stream to mux
|
|
* @returns {stream.Stream} - the multiplexed stream
|
|
*/
|
|
export function setupMultiplex (connectionStream) {
|
|
const mux = new ObjectMultiplex()
|
|
pump(
|
|
connectionStream,
|
|
mux,
|
|
connectionStream,
|
|
(err) => {
|
|
if (err) {
|
|
console.error(err)
|
|
}
|
|
},
|
|
)
|
|
return mux
|
|
}
|