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}),
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
import React from 'react';
|
||||
import getPort from 'get-port';
|
||||
import {Button, message, Switch, Typography, Select} from 'antd';
|
||||
import fs from 'fs/promises';
|
||||
import fs from 'fs';
|
||||
import {DevToolsEmbedder} from './DevToolsEmbedder';
|
||||
import {getInternalDevToolsModule} from './fb-stubs/getInternalDevToolsModule';
|
||||
|
||||
@@ -42,7 +42,7 @@ async function findGlobalDevTools(): Promise<string | undefined> {
|
||||
'node_modules',
|
||||
'react-devtools-core',
|
||||
);
|
||||
await fs.stat(devToolsPath);
|
||||
await fs.promises.stat(devToolsPath);
|
||||
return devToolsPath;
|
||||
} catch (error) {
|
||||
console.warn('Failed to find globally installed React DevTools: ' + error);
|
||||
|
||||
Reference in New Issue
Block a user