MCPcopy Create free account
hub / github.com/alibaba/open-code-review / downloadBinary

Function downloadBinary

scripts/install.js:128–144  ·  view source on GitHub ↗
(url, destPath)

Source from the content-addressed store, hash-verified

126}
127
128async function downloadBinary(url, destPath) {
129 const res = await download(url);
130 return new Promise((resolve, reject) => {
131 const fileStream = fs.createWriteStream(destPath);
132 res.on("error", (err) => {
133 fileStream.destroy();
134 fs.unlink(destPath, () => {});
135 reject(err);
136 });
137 res.pipe(fileStream);
138 fileStream.on("finish", () => fileStream.close(() => resolve()));
139 fileStream.on("error", (err) => {
140 fs.unlink(destPath, () => {});
141 reject(err);
142 });
143 });
144}
145
146function computeChecksum(filePath) {
147 return new Promise((resolve, reject) => {

Callers 1

mainFunction · 0.85

Calls 1

downloadFunction · 0.85

Tested by

no test coverage detected