-
Notifications
You must be signed in to change notification settings - Fork 1
/
consts.js
32 lines (27 loc) · 987 Bytes
/
consts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const path = require("path");
const binaryZip = {
"darwin-arm64": "osx-aarch_64.zip",
"darwin-x64": "osx-x86_64.zip",
"linux-x32": "linux-x86_32.zip",
"linux-x64": "linux-x86_64.zip",
"linux-arm64": "linux-aarch_64.zip",
"win32-x32": "win32.zip",
"win32-x64": "win64.zip"
}[process.platform + "-" + process.arch];
const latestReleaseUrl = "https://api.github.com/repos/protocolbuffers/protobuf/releases/latest"
const downloadUrlTemplate = `https://github.com/protocolbuffers/protobuf/releases/download/v{version}/protoc-{version}-${binaryZip}`
const protocDir = path.join(__dirname, "./protoc");
const binary = path.join(protocDir, "bin", `protoc${process.platform === "win32" ? ".exe" : ""}`);
const safeUnzip = Object.freeze({
MAX_FILES: 1_000,
MAX_SIZE: 20_000_000, // 20 MB
THRESHOLD_RATIO: 10
});
module.exports = Object.freeze({
binaryZip,
latestReleaseUrl,
downloadUrlTemplate,
protocDir,
binary,
safeUnzip
});