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
13
votes
2 answers
Is it safe to keep C# Filestream open for long periods of time?
Inside my web service, I open a filestream to a file on local disk. I keep this around for the lifetime of the service. For every query that comes in, I use the filestream to read the disk.
I do this to avoid having to reopen the filestream on every…

user201511
- 133
- 1
- 4
13
votes
8 answers
Streamreader to a relative filepath
I was wondering, if anyone could tell me how to point a StreamReader to a file inside the current working directory of the program.
E.g.: say I have program Prog saved in the directory "C:\ProgDir\". I commit "\ProgDir" to a shared folder. Inside…

gfppaste
- 1,111
- 4
- 18
- 48
12
votes
1 answer
node.js modify file data stream?
I need to copy one large data file to another destination with some modifications. fs.readFile and fs.writeFile are very slow. I need to read line by line, modify and write to new file. I found something like this:
fs.stat(sourceFile, function(err,…

Arti
- 7,356
- 12
- 57
- 122
12
votes
5 answers
C# Download big file from Server with less memory consumption
I have a big file of memory size 42 mb. I want to download the file with less memory consumption.
Controller Code
public ActionResult Download()
{
var filePath = "file path in server";
FileInfo file = new FileInfo(filePath);
…

anand
- 1,559
- 5
- 21
- 45
12
votes
3 answers
Improve speed of splitting file
I am using this code to extract a chunk from file
// info is FileInfo object pointing to file
var percentSplit = info.Length * 50 / 100; // extract 50% of file
var bytes = new byte[percentSplit];
var fileStream =…

Haris Hasan
- 29,856
- 10
- 92
- 122
12
votes
2 answers
How to read very large (> 1GB) tar.gz files in Node.js?
I have never had to do this before so this is probably something really basic, but I thought I'd ask anyways.
What is the right way to read a very large file in Node.js? Say the file is just too large to read all at once. Also say the file could…

Lance
- 75,200
- 93
- 289
- 503
11
votes
1 answer
How to backup a filestream database?
1.) How can I backup my FILESTREAM database on SQL Server 2008 from SQL Server Management Studio?
2.) Do I have to make a separate backup of the FILESTREAM folder on disc?

Zo Has
- 12,599
- 22
- 87
- 149
11
votes
1 answer
Save Icon File To Hard Drive
I know that this must be incredibly easy - It's unbelievable how long I have searched for an answer to this question based on how simple it is in VB6. I simply want to extract an Icon from an EXE File using Icon.ExtractAssociatedIcon, and then save…
user725913
11
votes
1 answer
Why is Stream.Copy faster than Stream.Write to FileStream?
I have a question and I can't find a reason for it.
I'm creating a custom archive file. I'm using MemoryStream to store data and finally I use a FileStream to write the data to disk.
My hard disk is an SSD, but the speed was too slow. When I tried…
user11043757
11
votes
3 answers
Why is ostringstream faster than ofstream
To write many piece of data to file, I have 2 approaches:
Write to ofstream one by one directly
ofstream file("c:\\test.txt");
for (int i = 0; i < 10000; ++i)
{
file << data[i];
}
Write to istringstream first, and then write to ofstream at…

Baiyan Huang
- 6,463
- 8
- 45
- 72
11
votes
0 answers
FileStream was asked to open a device that was not a file
I'm monitoring an FTP folder for orders which I then read into string array for further processing before deleting the file.
On the whole is works but occasionally I get the following exception:
FileStream was asked to open a device that was not a…

MarkBrad
- 171
- 2
- 10
11
votes
2 answers
How to speed up creation of a FileStream
My application needs to open a lot of small files, say 1440 files each containing data of 1 minute to read all the data of a certain day. Each file is only a couple of kB big. This is for a GUI application, so I want the user (== me!) to not have to…

wvl_kszen
- 183
- 1
- 10
11
votes
2 answers
Can [std::streampos] be converted to [size_t] implicitly?
#include
int main()
{
std::ifstream fin{ "" };
size_t n = fin.tellg(); // ok
}
The code compiles ok. However, according to cppreference, I find fin.tellg() is a type of std::fpos, which doesn't define the ability to convert…

xmllmx
- 39,765
- 26
- 162
- 323
11
votes
2 answers
Xamarin.Android pdf generator
I have been working on Xamarin.Android recently. I need to use pdf generator to send a report via email.
I have been came across to the following blog. I do not really know what to put in the FileStream fs = new FileStream (???????); In addition to…

casillas
- 16,351
- 19
- 115
- 215
11
votes
3 answers
FileStream: used by another process error
I have two different modules that need access to a single file (One will have ReadWrite Access - Other only Read). The file is opened using the following code in one of the modules:
FileStream fs1 = new FileStream(@"D:\post.xml", FileMode.Open,…

A9S6
- 6,575
- 10
- 50
- 82