Skip to content

Commit

Permalink
Security Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HellGio committed Nov 11, 2024
1 parent 780e69e commit 3e1850f
Show file tree
Hide file tree
Showing 3 changed files with 2,315 additions and 2,349 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
"dependencies": {
"@synonymdev/result": "0.0.2",
"adm-zip": "^0.5.9",
"request": "^2.88.2"
"axios": "^1.7.7"
}
}
25 changes: 18 additions & 7 deletions src/installer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const request = require('request');
const axios = require('axios');
const fs = require('fs');
var AdmZip = require('adm-zip');

Expand All @@ -7,14 +7,25 @@ var fileUrl = 'https://github.com/bitcoindevkit/bdk-swift/releases/download/0.30
const src = 'ios/bdkFFI.xcframework.zip';
const target = 'ios/';

try {
request(fileUrl)
.pipe(fs.createWriteStream(src))
.on('close', function () {
async function downloadAndExtract() {
try {
const response = await axios({
url: fileUrl,
method: 'GET',
responseType: 'stream',
});

const dest = fs.createWriteStream(src);
response.data.pipe(dest);

dest.on('finish', () => {
var zip = new AdmZip(src);
zip.extractAllTo(target, true);
fs.unlinkSync(src);
});
} catch (err) {
console.log(err);
} catch (err) {
console.log(err);
}
}

downloadAndExtract();
Loading

0 comments on commit 3e1850f

Please sign in to comment.