- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.9k
Closed
Labels
Description
Hi! Is it possible to send binary content with PUB/SUB in v4?
const { createClient } = require("redis");
(async () => {
  const client = createClient();
  await client.connect();
  const subscriber = client.duplicate();
  await subscriber.connect();
  await subscriber.subscribe("channel", (message, channel) => {
    console.log(Buffer.from(message, "utf8")); // prints "<Buffer ef bf bd ef bf bd ef bf bd>"
  });
  client.publish("channel", Buffer.from([0xa1, 0xa2, 0xa3]));
})();message is typed as string here:
| export type PubSubListener = (message: string, channel: string) => unknown; | 
And it seems we have no control over the setReturnBuffers() here:
| this.#parser.setReturnBuffers(!!this.#waitingForReply.head?.value.bufferMode); | 
Thanks in advance!
Environment:
- Node.js Version: v12.9.0
- Redis Server Version: 5.0.9
- Node Redis Version: 4.0.0-rc.3
- Platform: Ubuntu 20.04.3