sftpFileStream Seek() limited to 2GB file #1445
Unanswered
NigelGeniq
asked this question in
Q&A
Replies: 1 comment 1 reply
-
There is no MemoryStream in SftpFileStream, unless you are referring to somewhere else. In theory it should (i.e. is supposed to) work. What is the error+stack trace? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have files on an SFTP server and am using the sftpFileStream object's Seek(offset, origin) function to move to points within the files before reading a block of data of predefined size from them.
// Seek to the start position of the current block
sftpStream.Seek(start, SeekOrigin.Begin);
// Read the current block into the buffer
int bytesRead = sftpStream.Read(buffer, 0, currentBlockSize);
This works fine for most files, however I have found that if the file on the SFTP server is larger than 2GB, any attempt to Seek() to a start point beyond 2GB throws an error. I assume this is because the underlying MemoryStream is itself limited to 2GB Max?
Is there an elegant way around this, without having to either insist on source files smaller than 2GB, or writing something to split them up first?
Beta Was this translation helpful? Give feedback.
All reactions