Skip to content

Commit

Permalink
fixed indentation, removed request types
Browse files Browse the repository at this point in the history
  • Loading branch information
Mastermindzh committed Dec 9, 2024
1 parent 7305171 commit a44bf33
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 61 deletions.
71 changes: 19 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/node": "^20.14.10",
"@types/request": "^2.48.12",
"@types/swagger-ui-express": "^4.1.6",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.15.0",
Expand Down
19 changes: 11 additions & 8 deletions src/scripts/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ import axios from "axios";
*/
export const downloadFile = function (fileUrl: string, targetPath: string) {
return new Promise((resolve, reject) => {
axios.get(fileUrl, {
responseType: 'stream'
}).then((req) => {
const out = fs.createWriteStream(targetPath);
axios
.get(fileUrl, {
responseType: "stream",
})
.then((req) => {
const out = fs.createWriteStream(targetPath);

req.data.pipe(out);
req.data.pipe(out);

out.on("finish", resolve);
out.on("finish", resolve);

out.on("error", reject);
}).catch(reject);
out.on("error", reject);
})
.catch(reject);
});
};

0 comments on commit a44bf33

Please sign in to comment.