提交 88a6e810 编写于 作者: J Johannes Rieken

remote - don't read another time when encoding guessing already read the while file

上级 4cfb2487
......@@ -283,12 +283,19 @@ export class RemoteFileService extends FileService {
stream.write(chunk);
offset += chunk.length;
}
provider.read(resource, offset, Number.MAX_VALUE, new Progress<Buffer>(chunk => stream.write(chunk))).then(() => {
if (offset < count) {
// we didn't read enough the first time which means
// that we are done
stream.end();
}, err => {
stream.emit('error', err);
stream.end();
});
} else {
// there is more to read
provider.read(resource, offset, Number.MAX_VALUE, new Progress<Buffer>(chunk => stream.write(chunk))).then(() => {
stream.end();
}, err => {
stream.emit('error', err);
stream.end();
});
}
return {
encoding: preferredEncoding,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册