Use download file API in MobileBuildsPlugin
Summary: Facenook: Use downloadFile API in Mobile Builds plugin Reviewed By: mweststrate Differential Revision: D32922041 fbshipit-source-id: d554ed9287af3bda4329e87732ab4de67136c0d2
This commit is contained in:
committed by
Facebook GitHub Bot
parent
92f0ed67f4
commit
6aa0cef927
@@ -44,8 +44,10 @@ import {
|
||||
internGraphPOSTAPIRequest,
|
||||
} from './fb-stubs/internRequests';
|
||||
import {commandNodeApiExec} from './commands/NodeApiExec';
|
||||
import {access, copyFile, mkdir, unlink} from 'fs/promises';
|
||||
import {commandDownloadFileStartFactory} from './commands/DownloadFile';
|
||||
import {promises} from 'fs';
|
||||
|
||||
const {access, copyFile, mkdir, unlink} = promises;
|
||||
|
||||
export const SERVICE_FLIPPER = 'flipper.oAuthToken';
|
||||
|
||||
|
||||
@@ -55,7 +55,10 @@ export const commandDownloadFileStartFactory =
|
||||
maxRedirects,
|
||||
headers,
|
||||
});
|
||||
const totalSize = response.headers['content-length'] ?? 0;
|
||||
let totalSize = parseInt(response.headers['content-length'], 10);
|
||||
if (Number.isNaN(totalSize)) {
|
||||
totalSize = 0;
|
||||
}
|
||||
|
||||
const writeStream = response.data.pipe(
|
||||
createWriteStream(dest, {autoClose: true}),
|
||||
|
||||
Reference in New Issue
Block a user