Questions tagged [filestream]

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.

2765 questions
0
votes
2 answers

Cannot access a closed file in ASP.Net (saving files in zip file)

I got this error "Cannot access a closed file" when I save more than one file in zip. This is the code. Error at zip.Save(NewZipPath); internal static string UpdateZipFile(string PdfPath, string ZipPath, string NewZipPath,…
Kashif
  • 14,071
  • 18
  • 66
  • 98
0
votes
1 answer

Using HttpWebRequest/Response To Download A Binary (.exe) File From A Web Server?

I am writing a program that needs to download an .exe file from a website and then save it to the hard drive. After many web searches and fumbling through examples here is the code I have come up with so far: HttpWebRequest webRequest =…
Ahsan
  • 2,964
  • 11
  • 53
  • 96
0
votes
1 answer

FileStream keeps saying that the file is busy while it's not opened by any application at all

I am trying to create a program that writes some kind of data to a file in C#. when I tried running the code, the console said that the file is busy even though I am not opening it at all. using System; using System.Collections.Generic; using…
0
votes
2 answers

how to avoid this exception when i use file stream in dot net core 6

I'm using visual studio 2022 dot net core6 and i want to save image file stream in my folder i have used stream files written to successfully but i want to avoid this exception Exception: The process cannot access the file 'D:\muthu\ads\Screenshot…
0
votes
3 answers

C# serialize only values into a byte stream

Is there any possibility to automatically serialize properties of a class into a byte[] array or stream. Stream stream = File.Open(@"C:/traiBin.bin", FileMode.Create); BinaryFormatter bFormatter = new BinaryFormatter(); bFormatter.Serialize(stream,…
0
votes
1 answer

How can I open External memory file as FileStream is c#

I have a file on a external device This PC\HERO4 Session\External Memory\DCIM\101GOPRO. Is there a way I can read this file in c# using File.OpenRead("This PC\HERO4 Session\External Memory\DCIM\101GOPRO") because when I tried to my desktop WPF app…
0
votes
1 answer

Problem with reading files in FileStream asp.net

I've a wired problem in my project, I'm trying to file stream some .acc format by ASP.net and it works perfectly fine in some files (which I realized for file size less than 1 megabyte it seems work fine), but in many cases browser player pretend…
0
votes
1 answer

IO.FileStream/JSON options to ignore portions of the file being parsed

I have a case where I'm being sent a large file with JSON data in it. Unfortunately it has a small line of overhead string data at the start of the file and another line of overhead string data at the end of the file. I was previously reading in the…
DarrenMB
  • 2,342
  • 1
  • 21
  • 26
0
votes
1 answer

Node JS read the byte stream file and store it in storage

I am user NodeJS and Express to run a microservice. This microservice(ms1) make a request to another microservice(ms2) to get a file(XLSX). The problem here is, the response of ms2 is a byte stream. I want to read those byte stream response in node…
0
votes
1 answer

Reliable approach to track new text in a text file

I'm trying to make a program to track changes in a list of text files (only appending type of changes). Working with FileStream class I encounter ArgumentException telling "offset and length were out of bounds for the array or count is greater than…
0
votes
1 answer

Is there a faster way to read data with a FileStream?

So I'm trying to read data and store it in an array as fast as possible and the fastest method I found of doing so was this. var filePath = "data.dat"; FileStream fs = new FileStream(filePath, FileMode.Open); bool[] buffer = new…
JohnA
  • 564
  • 1
  • 5
  • 20
0
votes
1 answer

Reading part of file in node

i have 2 json objects inside large .txt files in electron enviroment. What's the proper way of: reading first json object in file ignoring the second looping this behaviour for each file in asynchronous way This is how i'm accessing files with 1…
0
votes
0 answers

Is there an overhead for opening or closing UNC paths in a FileStream that can be overcome by slowing down?

I'm trying to transfer a large file in "chunks" that then have their hashes validated. I am looking into some performance issues, particularly in UNC paths, and I wrote an IO test that exhibits strange behavior. Here is the code: string path =…
AMunns
  • 3
  • 2
0
votes
0 answers

SQL Server Filestream query for updating the filestream column using the file path column present in the table

I have a table in Microsoft SQL Server with file path, now I want to store the files as filestream data in the database. I want to run a bulk update query to convert each row of the table to the corresponding filestream data using the filepath…
Sam
  • 1
0
votes
0 answers

C++ ifstream a char array

Hey I found a source code for my needs which accesses a .dll file with an ifstream and reads it with the following code: std::ifstream File(@"C:\dllfile.dll", std::ios::binary | std::ios::ate); if (File.fail()) { printf("Opening the file…
1 2 3
99
100