In .NET framework filestream exposes a Stream around a file, supporting both synchronous and asynchronous read and write operations. ActionScript 3 for AIR 2 and above also uses FileStream, which supports both synchronous and asynchronous read and write operations.
Questions tagged [filestream]
2765 questions
11
votes
2 answers
StreamReader and Portable Class Library
I am writing a ConfigManager class using Portable Class Libraries. PCL supports StreamReader and StreamWriter classes that I want to use, but the PCL version of those classes do not support passing in a string during construction. PCL also does not…

Anthony Nichols
- 1,586
- 2
- 25
- 50
11
votes
2 answers
How to create fast and efficient filestream writes on large sparse files
I have an application that writes large files in multiple segments. I use FileStream.Seek to position each wirte. It appears that when I call FileStream.Write at a deep position in a sparse file the write triggers a "backfill" operation (writeing…

revoxover
- 965
- 1
- 7
- 10
11
votes
3 answers
Best way to store images for a website
Can someone guide me on the best way to store images for my website. Im making my first MVC website, and i thought i would just start with a Image website with comments on those images..ect
Im displaying my images in a gallery using javascript,…

Mike Loder
- 141
- 1
- 1
- 4
11
votes
2 answers
file stream vs local save in sql server?
my application play videos files after that user they are registered .(files are larger than 100 MB ) .
Is it better to do I store them on the hard drive and Keep file path in database ?
Or
do I store in database as File Stream Type ?
When…

user2135285
- 125
- 1
- 5
11
votes
4 answers
FileStream.close() does not free file for other processes
I have Following Code in a Page_Load called function. When the Page is loaded the first time after starting Visual Studio, everything works out fine.
But any other opening call to the File after that returns IOException: "File is in use by another…

Vogel612
- 5,620
- 5
- 48
- 73
11
votes
4 answers
C# - How do I read and write a binary file?
How do I read a raw byte array from any file, and write that byte array back into a new file?

Robin Rodricks
- 110,798
- 141
- 398
- 607
11
votes
3 answers
FileStream with DeleteOnClose File option
In my project I have to create some temp files in an USB device, which I want to delete on Closing. So I used a code like
this.fcommandHandler = new FileStream(TempFileName,
FileMode.CreateNew, FileAccess.ReadWrite,
FileShare.ReadWrite, 512,…

Anuraj
- 18,859
- 7
- 53
- 79
11
votes
4 answers
file IO, is this a bug in Powershell?
I have the following code in Powershell
$filePath = "C:\my\programming\Powershell\output.test.txt"
try
{
$wStream = new-object IO.FileStream $filePath, [System.IO.FileMode]::Append, [IO.FileAccess]::Write, [IO.FileShare]::Read
$sWriter =…

user1866880
- 1,437
- 6
- 18
- 26
10
votes
3 answers
Using FileStream without an actual file
I wanted to use the FileStream class to avoid saving any files on the
client's computer. But every constructor of FileStream requires a path
to a file.
How do I create a FileStream from a stream and not have to save it on the harddrive?
EDIT:…

user779444
- 1,365
- 4
- 21
- 38
10
votes
4 answers
How does simply piping to the response object render data to the client?
In the example code in this article, how is the last segment of the stream working on the line:
fs.createReadStream(filePath).pipe(brotli()).pipe(res)
I understand that the first part reading the file, the second is compressing it, but what is…

1252748
- 14,597
- 32
- 109
- 229
10
votes
4 answers
Reading a HttpPostedFile before saving it saves a blank file in ASP.NET MVC
Before saving an uploaded csv file I want to check it will parse. When I was just saving the file everything was fine, now that I'm reading it first the file saved is blank.
Here is my action method
[HttpPost]
public ActionResult…

Richard Garside
- 87,839
- 11
- 80
- 93
10
votes
2 answers
Does move assign an std::fstream close the original stream
Since c++11, we can move assign one std::fstream object to another, but I'm unable to find documentation that states, what happens if the fstream object is already associated with a file (is_open()==true).
So my question is whether in the following…

MikeMB
- 20,029
- 9
- 57
- 102
10
votes
4 answers
OutOfMemoryException when send big file 500MB using FileStream ASPNET
I'm using Filestream for read big file (> 500 MB) and I get the OutOfMemoryException.
I use Asp.net , .net 3.5, win2003, iis 6.0
I want this in my app:
Read DATA from Oracle
Uncompress file using FileStream and BZip2
Read file uncompressed and…

Kiquenet
- 14,494
- 35
- 148
- 243
10
votes
3 answers
Loading Image to Filestream
I am loading an image using
OpenFileDialog open = new OpenFileDialog();
After I select the file, "open" is populated with several items, including the path.
Now I would like to load the file into a filestream (or something similar) to be sent via…

mouthpiec
- 3,923
- 18
- 54
- 73
10
votes
6 answers
FileStream to save file then immediately unlock in .NET?
I have this code that saves a pdf file.
FileStream fs = new FileStream(SaveLocation, FileMode.Create);
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
fs.Flush();
fs.Close();
It works fine. However sometimes it does not release the…

aron
- 2,856
- 11
- 49
- 79