mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Hotfix skipping the first chunks of the artifacts
This commit is contained in:
parent
eabbeec14c
commit
2d32e97cf9
1 changed files with 7 additions and 6 deletions
|
@ -114,15 +114,16 @@ async function downloadFile(
|
||||||
|
|
||||||
log.debug("Downloading file of", totalBytes, "bytes size from", url, "to", destFilePath);
|
log.debug("Downloading file of", totalBytes, "bytes size from", url, "to", destFilePath);
|
||||||
|
|
||||||
|
// Put the artifact into a temporary folder to prevent partially downloaded files when user kills vscode
|
||||||
|
await withTempFile(async tempFilePath => {
|
||||||
|
const destFileStream = fs.createWriteStream(tempFilePath, { mode });
|
||||||
|
|
||||||
let readBytes = 0;
|
let readBytes = 0;
|
||||||
res.body.on("data", (chunk: Buffer) => {
|
res.body.on("data", (chunk: Buffer) => {
|
||||||
readBytes += chunk.length;
|
readBytes += chunk.length;
|
||||||
onProgress(readBytes, totalBytes);
|
onProgress(readBytes, totalBytes);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Put the artifact into a temporary folder to prevent partially downloaded files when user kills vscode
|
|
||||||
await withTempFile(async tempFilePath => {
|
|
||||||
const destFileStream = fs.createWriteStream(tempFilePath, { mode });
|
|
||||||
await pipeline(res.body, destFileStream);
|
await pipeline(res.body, destFileStream);
|
||||||
await new Promise<void>(resolve => {
|
await new Promise<void>(resolve => {
|
||||||
destFileStream.on("close", resolve);
|
destFileStream.on("close", resolve);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue