698
699
private readFileUnbuffered(provider: IFileSystemProviderWithFileReadWriteCapability | IFileSystemProviderWithFileAtomicReadCapability, resource: URI, options?: IReadFileOptions & IReadFileStreamOptions): VSBufferReadableStream {
700
>
const stream = newWriteableStream<VSBuffer>(data => VSBuffer.concat(data));
fileService.ts
701
>
702
>
// Read the file into the stream async but do not wait for
703
>
// this to complete because streams work via events
704
>
(async () => {
705
>
try {
706
>
let buffer: Uint8Array;
707
>
if (options?.atomic && hasFileAtomicReadCapability(provider)) {
708
buffer = await provider.readFile(resource, { atomic: true });
710
>
buffer = await provider.readFile(resource);
711
}
712
713
// respect position option
715
buffer = buffer.slice(options.position);
716
}
717
718
// respect length option
720
buffer = buffer.slice(0, options.length);
721
}