Skip to content

Instantly share code, notes, and snippets.

@TrejGun
Created December 10, 2021 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TrejGun/8b095e6c9ceb533a4ff86435f8548593 to your computer and use it in GitHub Desktop.
Save TrejGun/8b095e6c9ceb533a4ff86435f8548593 to your computer and use it in GitHub Desktop.
buffer to stream
import { Readable } from "stream";
export const getReadableStream = (buffer: Buffer): Readable => {
const stream = new Readable();
stream.push(buffer);
stream.push(null);
return stream;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment