You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using FileService.readFile to only read a part of a file ({ length: 2 } option), the API still reads in the full file and then only returns the requested bytes.
This did cause in my usage to detect the file type that it failed for files > 2GB unnecessarily.
But even for files < 2GB, silently reading in much more than was requested is quite inefficient. The handling is according tot he source comment, and optimization. Maybe it should not happen if a length is requested?
Not a big problem for me, I'm not using as workaround FileService.readFileStream
`// Workaround for FileService.readFile to just read the file unbuffered as optimization.
// This breaks to read the first 2 bytes of a > 2GB file as in that code flow it reads the whole monster and then cuts
// afterwards. The workaround bypasses that code and reads the file as a stream.
When using FileService.readFile to only read a part of a file ({ length: 2 } option), the API still reads in the full file and then only returns the requested bytes.
This did cause in my usage to detect the file type that it failed for files > 2GB unnecessarily.
But even for files < 2GB, silently reading in much more than was requested is quite inefficient. The handling is according tot he source comment, and optimization. Maybe it should not happen if a length is requested?
Not a big problem for me, I'm not using as workaround FileService.readFileStream
`// Workaround for FileService.readFile to just read the file unbuffered as optimization.
// This breaks to read the first 2 bytes of a > 2GB file as in that code flow it reads the whole monster and then cuts
// afterwards. The workaround bypasses that code and reads the file as a stream.
async function readFileBuffered(fileService: FileService, resource: URI, options?: ReadFileOptions): Promise {
const stream = await fileService.readFileStream(resource, options);
return {
...stream,
value: await BinaryBufferReadableStream.toBuffer(stream.value)
};
}
`
but through still worth reporting as issue to possibly improve.
The text was updated successfully, but these errors were encountered: