How to use the it-length-prefixed.encode function in it-length-prefixed

To help you get started, we’ve selected a few it-length-prefixed examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github libp2p / js-libp2p / src / identify / index.js View on Github external
if (this.peerInfo.id.pubKey) {
      publicKey = this.peerInfo.id.pubKey.bytes
    }

    const message = Message.encode({
      protocolVersion: PROTOCOL_VERSION,
      agentVersion: AGENT_VERSION,
      publicKey,
      listenAddrs: this.peerInfo.multiaddrs.toArray().map((ma) => ma.buffer),
      observedAddr: connection.remoteAddr.buffer,
      protocols: Array.from(this._protocols.keys())
    })

    pipe(
      [message],
      lp.encode(),
      stream
    )
  }

it-length-prefixed

Streaming length prefixed buffers with async iterables

Apache-2.0 OR MIT
Latest version published 4 months ago

Package Health Score

71 / 100
Full package analysis