Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 1.82 KB

README.md

File metadata and controls

67 lines (48 loc) · 1.82 KB

@individe/libp2p-snappy-muxer

individe.xyz endlesshorizons.xyz

libp2p's mplex muxer extended with snappy compression, made to be used with Individe IPFS nodes.

Table of contents

Install

$ npm i @individe/libp2p-snappy-muxer

Usage

Snappy muxer extends Mplex. It compresses all outgoing streams towards nodes that implement /mplex/snappy/x.x.x multistream protocol and decompresses incoming streams from the nodes that implement that same protocol. Compression algorithm used is snappy.

libp2p

import { SnappyMplex } from '@individe/libp2p-snappy-muxer'
import { createLibp2p } from 'libp2p'

const node = await createLibp2p({
  streamMuxers: [
    new SnappyMplex()
  ]
})

ipfs

import { SnappyMplex } from '@individe/libp2p-snappy-muxer'
import { createLibp2p } from 'libp2p'
import * as IPFS from 'ipfs-core'

(async () => {
  const libp2p = await createLibp2p({
    streamMuxers: [
      new SnappyMplex()
    ]
  })

  const ipfs = await IPFS.create({
    libp2p: libp2p
  })
})()

License

Licensed under either of