mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-25 15:01:34 +00:00
deps: update it-length-prefix, uint8arraylist etc (#1317)
In order to support no-copy operations in streams, update all deps to support streaming Uint8ArrayLists.
This commit is contained in:
@ -10,6 +10,7 @@ import type { Libp2pInit, Libp2pOptions } from '../../src/index.js'
|
||||
import type { PeerId } from '@libp2p/interface-peer-id'
|
||||
import * as cborg from 'cborg'
|
||||
import { peerIdFromString } from '@libp2p/peer-id'
|
||||
import { Uint8ArrayList } from 'uint8arraylist'
|
||||
|
||||
const relayAddr = MULTIADDRS_WEBSOCKETS[0]
|
||||
|
||||
@ -32,16 +33,16 @@ class MockPubSub extends PubSubBaseProtocol {
|
||||
return cborg.decode(bytes)
|
||||
}
|
||||
|
||||
encodeRpc (rpc: PubSubRPC): Uint8Array {
|
||||
return cborg.encode(rpc)
|
||||
encodeRpc (rpc: PubSubRPC): Uint8ArrayList {
|
||||
return new Uint8ArrayList(cborg.encode(rpc))
|
||||
}
|
||||
|
||||
decodeMessage (bytes: Uint8Array): PubSubRPCMessage {
|
||||
return cborg.decode(bytes)
|
||||
}
|
||||
|
||||
encodeMessage (rpc: PubSubRPCMessage): Uint8Array {
|
||||
return cborg.encode(rpc)
|
||||
encodeMessage (rpc: PubSubRPCMessage): Uint8ArrayList {
|
||||
return new Uint8ArrayList(cborg.encode(rpc))
|
||||
}
|
||||
|
||||
async publishMessage (from: PeerId, message: Message): Promise<PublishResult> {
|
||||
|
Reference in New Issue
Block a user