Skip to content

Commit 5479fb1

Browse files
committed
fix(wpt): download files as buffer instead of text
There are binary files in the WPT repository and downloading them as text corrupts them. Refs: nodejs/node#37294
1 parent 059c138 commit 5479fb1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/github/tree.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ class GitHubTree {
5858
return `${this.repoUrl}/tree/${commit.slice(0, 10)}/${this.path}`;
5959
}
6060

61-
async text(assetPath) {
61+
async buffer(assetPath) {
6262
await this.getLastCommit();
6363
const url = this.getAssetUrl(assetPath);
64-
return this.request.text(url);
64+
return this.request.buffer(url);
6565
}
6666

6767
/**

lib/request.js

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class Request {
3737
return wrappedFetch(url, options);
3838
}
3939

40+
async buffer(url, options = {}) {
41+
return this.fetch(url, options).then(res => res.buffer());
42+
}
43+
4044
async text(url, options = {}) {
4145
return this.fetch(url, options).then(res => res.text());
4246
}

0 commit comments

Comments
 (0)