StreamHandler Read Bytes

Getting bytes from a stream or file is quite a normal scenario & once you are able to retrieve the bytes, it can be saved in database as BLOB content as well. This is very handy way of storing any file type (text, audio, video, pdf, etc.) and then play around.

Below is C# implementation to do the same:

“ReadBytes” is an overloaded method that accepts either stream object or file name (with path) and returns the byte array.