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

@expo/downloader

Package Overview
Dependencies
Maintainers
20
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.6 to 0.0.7

14

dist/index.js

@@ -6,15 +6,17 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const stream_1 = __importDefault(require("stream"));
const util_1 = require("util");
const node_fetch_1 = __importDefault(require("node-fetch"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const got_1 = __importDefault(require("got"));
const pipeline = util_1.promisify(stream_1.default.pipeline);
async function downloadFile(srcUrl, outputPath, timeout) {
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}`);
try {
await pipeline(got_1.default.stream(srcUrl, { timeout }), fs_extra_1.default.createWriteStream(outputPath));
}
await pipeline(res.body, fs_1.default.createWriteStream(outputPath));
catch (err) {
await fs_extra_1.default.remove(outputPath);
throw new Error(`Failed to download the file: ${err === null || err === void 0 ? void 0 : err.message}\n${err === null || err === void 0 ? void 0 : err.stack}`);
}
}
exports.default = downloadFile;
//# sourceMappingURL=index.js.map
{
"name": "@expo/downloader",
"version": "0.0.6",
"version": "0.0.7",
"main": "dist/index.js",

@@ -18,9 +18,13 @@ "types": "dist/index.d.ts",

"lint": "eslint 'src/**/*.ts'",
"test": "yarn run jest"
"test:unit": "echo \"no tests found\" || ./resources/jest --config jest.config.unit.js",
"test:unit:watch": "./resources/jest --config jest.config.unit.js --watch",
"test:integration": "./resources/jest --runInBand --config jest.config.integration.js",
"test:integration:watch": "./resources/jest --runInBand --config jest.config.integration.js --watchAll"
},
"dependencies": {
"node-fetch": "^2.6.0"
"fs-extra": "^9.0.0",
"got": "^11.1.4"
},
"devDependencies": {
"@types/node-fetch": "^2.5.5",
"@types/fs-extra": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^2.11.0",

@@ -31,4 +35,6 @@ "@typescript-eslint/parser": "^2.11.0",

"eslint-config-airbnb-typescript": "^6.3.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.19.1",
"jest": "^24.9.0",
"prettier": "^2.0.5",
"ts-jest": "^24.2.0",

@@ -35,0 +41,0 @@ "typescript": "^3.7.3"

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