I'm working on a web app which will display LARGE tiff image files (e.g
files 10-20+ mb). Files are hidden from users direct access. For other,
smaller image files I have used FileStream to read in a file in a single
Read and so my quesitons are:
(1) What is a practical file size limit for reading using FileStream.Read
(reading the file in a single read)...especially on a web server where I
don't think I'd want to tax memory resources by to many simultaneous large
file reads?
(2) For a file larger than the practical size limit what's the best means
to read the file in chunks? Streams are not my forte so any code samples
are appreciated if applicable.
Here iss code I've used for a single read using FileStream. Seem to work
fine with large tiff but again the concern is resources (memory) on a
produciton web.
Dim fs As FileStream = New FileStream(outputFile,
FileMode.Open)
Try
Dim bufferSize As Integer = CType(fs.Length,
Integer)
Dim buffer(bufferSize) As Byte
fs.Read(buffer, 0, bufferSize)
Current.Response.BinaryWrite(buffer)
Catch ex As Exception
Finally
fs.Close()
End Try
Thanks
- Brad