Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@expo/downloader

Package Overview
Dependencies
Maintainers
18
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@expo/downloader - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

17

dist/index.js

@@ -7,13 +7,14 @@ "use strict";

const fs_1 = __importDefault(require("fs"));
const got_1 = __importDefault(require("got"));
const stream_1 = __importDefault(require("stream"));
const util_1 = require("util");
const node_fetch_1 = __importDefault(require("node-fetch"));
const pipeline = util_1.promisify(stream_1.default.pipeline);
async function downloadFile(srcUrl, outputPath, timeout) {
const writeStream = fs_1.default.createWriteStream(outputPath);
const stream = got_1.default.stream(srcUrl, { timeout });
stream.pipe(writeStream);
await new Promise((res, rej) => {
stream.on('end', () => res());
stream.on('error', (err) => rej(err));
});
const res = await node_fetch_1.default(srcUrl, { timeout });
if (res.status !== 200) {
throw new Error(`Failed to download the file, status code: ${res.status}`);
}
await pipeline(res.body, fs_1.default.createWriteStream(outputPath));
}
exports.default = downloadFile;
//# sourceMappingURL=index.js.map
{
"name": "@expo/downloader",
"version": "0.0.2",
"version": "0.0.3",
"main": "dist/index.js",

@@ -16,2 +16,3 @@ "types": "dist/index.d.ts",

"compile": "tsc -p tsconfig.build.json",
"prepublishOnly": "npm run build",
"lint": "eslint 'src/**/*.ts'",

@@ -21,7 +22,6 @@ "test": "yarn run jest"

"dependencies": {
"got": "^10.6.0"
"node-fetch": "^2.6.0"
},
"devDependencies": {
"@types/bunyan": "^1.8.6",
"@types/got": "^9.6.9",
"@types/node-fetch": "^2.5.5",
"@typescript-eslint/eslint-plugin": "^2.11.0",

@@ -28,0 +28,0 @@ "@typescript-eslint/parser": "^2.11.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc