diff --git a/docs/core-api/PUBSUB.md b/docs/core-api/PUBSUB.md index 4778181e6b..d221b96dee 100644 --- a/docs/core-api/PUBSUB.md +++ b/docs/core-api/PUBSUB.md @@ -53,7 +53,7 @@ An optional object which may have the following keys: ```JavaScript const topic = 'fruit-of-the-day' -const receiveMsg = (msg) => console.log(msg.data.toString()) +const receiveMsg = (msg) => console.log(new TextDecoder().decode(msg.data)) await ipfs.pubsub.subscribe(topic, receiveMsg) console.log(`subscribed to ${topic}`) @@ -203,4 +203,4 @@ console.log(peerIds) A great source of [examples][] can be found in the tests for this API. [examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/pubsub -[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal \ No newline at end of file +[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal