Skip to content

Commit 09d61b6

Browse files
committed
Drop cross-fetch from APK fetching logic
Node-fetch v2 used here internally has notable bugs with truncated responses and similar so this should help clean some things up (and drops a totally unnecessary dep)
1 parent daa39cf commit 09d61b6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/interceptors/android/fetch-apk.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as path from 'path';
22
import * as stream from 'stream';
33
import * as semver from 'semver';
4-
import fetch from 'node-fetch';
54

65
import * as fs from '../../util/fs';
76
import { HtkConfig } from '../../config';
@@ -144,7 +143,7 @@ export async function streamLatestApk(config: HtkConfig): Promise<stream.Readabl
144143
if (!apkResponse.ok) {
145144
throw new Error(`APK download failed with ${apkResponse.status}`);
146145
}
147-
const apkStream = apkResponse.body;
146+
const apkStream = stream.Readable.fromWeb(apkResponse.body as any);
148147

149148
// We buffer output into two passthrough streams, so both file & install
150149
// stream usage can be set up async independently. Buffers are 10MB, to
@@ -177,7 +176,7 @@ export async function streamLatestApk(config: HtkConfig): Promise<stream.Readabl
177176
// We have a local APK & a remote APK, and the remote is newer.
178177
// Try to update it async, and use the local APK in the meantime.
179178
fetch(latestApkRelease.url).then((apkResponse) => {
180-
const apkStream = apkResponse.body;
179+
const apkStream = stream.Readable.fromWeb(apkResponse.body as any);
181180
return updateLocalApk(latestApkRelease.version, apkStream, config);
182181
}).catch(logError);
183182

0 commit comments

Comments
 (0)