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

@mongodb-js/mongodb-downloader

Package Overview
Dependencies
Maintainers
31
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mongodb-js/mongodb-downloader - npm Package Compare versions

Comparing version 0.2.6 to 0.2.7

24

dist/index.js

@@ -12,3 +12,3 @@ "use strict";

const path_1 = __importDefault(require("path"));
const download_1 = __importDefault(require("download"));
const decompress_1 = __importDefault(require("decompress"));
const stream_1 = require("stream");

@@ -19,4 +19,3 @@ const mongodb_download_url_1 = __importDefault(require("mongodb-download-url"));

async function downloadMongoDb(tmpdir, targetVersionSemverSpecifier = '*', options = {}) {
var _a;
let wantsEnterprise = (_a = options.enterprise) !== null && _a !== void 0 ? _a : false;
let wantsEnterprise = options.enterprise ?? false;
async function lookupDownloadUrl() {

@@ -43,5 +42,4 @@ return (await (0, mongodb_download_url_1.default)({

async function doDownload(tmpdir, isCryptLibrary, version, lookupDownloadUrl) {
var _a;
const downloadTarget = path_1.default.resolve(tmpdir, `mongodb-${process.platform}-${process.env.DISTRO_ID || 'none'}-${process.arch}-${version}`.replace(/[^a-zA-Z0-9_-]/g, ''));
return ((_a = downloadPromises[downloadTarget]) !== null && _a !== void 0 ? _a : (downloadPromises[downloadTarget] = (async () => {
return (downloadPromises[downloadTarget] ??= (async () => {
const bindir = path_1.default.resolve(downloadTarget, isCryptLibrary && process.platform !== 'win32' ? 'lib' : 'bin');

@@ -53,3 +51,3 @@ try {

}
catch (_a) {
catch {
}

@@ -59,11 +57,17 @@ await fs_1.promises.mkdir(downloadTarget, { recursive: true });

debug(`Downloading ${url} into ${downloadTarget}...`);
const HWM = 1024 * 1024;
async function downloadAndExtract(withExtraStripDepth = 0) {
const response = await (0, node_fetch_1.default)(url, {
highWaterMark: HWM,
});
if (/\.tgz$|\.tar(\.[^.]+)?$/.exec(url)) {
const response = await (0, node_fetch_1.default)(url);
await (0, util_1.promisify)(stream_1.pipeline)(response.body, tar_1.default.x({ cwd: downloadTarget, strip: isCryptLibrary ? 0 : 1 }));
}
else {
await (0, download_1.default)(url, downloadTarget, {
extract: true,
const filename = path_1.default.join(downloadTarget, path_1.default.basename(new URL(url).pathname));
await (0, util_1.promisify)(stream_1.pipeline)(response.body, (0, fs_1.createWriteStream)(filename, { highWaterMark: HWM }));
debug(`Written file ${url} to ${filename}, extracting...`);
await (0, decompress_1.default)(filename, downloadTarget, {
strip: isCryptLibrary ? 0 : 1,
filter: (file) => path_1.default.extname(file.path) !== '.pdb',
});

@@ -85,4 +89,4 @@ }

return bindir;
})()));
})());
}
//# sourceMappingURL=index.js.map

@@ -16,3 +16,3 @@ {

"homepage": "https://github.com/mongodb-js/devtools-shared",
"version": "0.2.6",
"version": "0.2.7",
"repository": {

@@ -51,3 +51,3 @@ "type": "git",

"debug": "^4.3.4",
"download": "^8.0.0",
"decompress": "^4.2.1",
"mongodb-download-url": "^1.3.0",

@@ -58,8 +58,8 @@ "node-fetch": "^2.6.11",

"devDependencies": {
"@mongodb-js/eslint-config-devtools": "0.9.9",
"@mongodb-js/mocha-config-compass": "^0.10.0",
"@mongodb-js/eslint-config-devtools": "0.9.10",
"@mongodb-js/mocha-config-devtools": "^1.0.1",
"@mongodb-js/prettier-config-devtools": "^1.0.1",
"@mongodb-js/tsconfig-compass": "^0.6.0",
"@mongodb-js/tsconfig-devtools": "^1.0.1",
"@types/debug": "^4.1.8",
"@types/download": "^8.0.2",
"@types/decompress": "^4.2.4",
"@types/mocha": "^9.0.0",

@@ -76,3 +76,3 @@ "@types/node": "^17.0.35",

},
"gitHead": "f68234866e6fb0851dbc52bcb93dc5433ae3faf6"
"gitHead": "9c41f233d529e7b5cac1849a0a07ca2076fcdbb0"
}

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