'How to parse video stream coming from the nodejs server

I'm creating a video streaming service, the backend code look like this:

const stream = new Readable();
stream.push(movie.data.slice(start, end + 1));
stream.push(null);
stream.pipe(res);

This when run in postman, postman automatically parses it and give me a video in the response. But when I'm using it in my code, it gives me responses in random characters

`ftypmp42isommp42îmoovlmvhdè'@trak\tkhd&è@hmdia mdhd2òUÄGhdlrvideISO Media file produced by Google Inc.°minf$dinfdrefurl pstblstsdavc1hHHÿÿ2avcCBÀÿágBÀÚ¿åÀZ  AâÅÔhÎ<sttsù4stsc

dstco õÆSLÕÆH?ÛÔHAͰG.4¥¹®4³¤(ù¯- Å GÐ î¿østszùHÕ7ÈÕI~hS< ©ÅºÒ 3k 7 (;²w¶¸¯Ð«¥y¾mÙEòÙÕ樧 nºK|'eiõE^H2_&Z£ÇVpÛË?O*z"±ÿ{¢×Õg&°]Øe¡OË¿£½í¯¥^y§t=ª$®Ü'² ²-míÜÆ£%(¶zÎ,4qj z º5ªÓ@ã§ !ßó¢uÌÎÏ£¢¿ß(u;xû/]ù%¡ErµÒà1§5&¬¤'£,i5Ó3óØ(â[¬³föçÑÀH [`

Now the problem is that I don't know what is this, how to parse it, how to display it as a video... Need help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source