Created
December 10, 2021 11:45
-
-
Save TrejGun/8b095e6c9ceb533a4ff86435f8548593 to your computer and use it in GitHub Desktop.
buffer to stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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