Socket
Socket
Sign inDemoInstall

@electron/get

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electron/get - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

2

dist/cjs/index.js

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

}
return [4 /*yield*/, utils_1.withTempDirectory(function (tempFolder) { return __awaiter(_this, void 0, void 0, function () {
return [4 /*yield*/, utils_1.withTempDirectoryIn(artifactDetails.tempDirectory, function (tempFolder) { return __awaiter(_this, void 0, void 0, function () {
var tempDownloadPath, downloader, _a, shasumPath;

@@ -117,0 +117,0 @@ return __generator(this, function (_b) {

@@ -60,2 +60,7 @@ import { Downloader } from './Downloader';

downloader?: Downloader<any>;
/**
* A temporary directory for downloads.
* It is used before artifacts are put into cache.
*/
tempDirectory?: string;
}

@@ -62,0 +67,0 @@ export declare type ElectronPlatformArtifactDetails = {

@@ -0,1 +1,2 @@

export declare function withTempDirectoryIn<T>(parentDirectory: string | undefined, fn: (directory: string) => Promise<T>): Promise<T>;
export declare function withTempDirectory<T>(fn: (directory: string) => Promise<T>): Promise<T>;

@@ -2,0 +3,0 @@ export declare function normalizeVersion(version: string): string;

@@ -42,33 +42,18 @@ "use strict";

var path = require("path");
function withTempDirectory(fn) {
function useAndRemoveDirectory(directory, fn) {
return __awaiter(this, void 0, void 0, function () {
var directory, result, err_1, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-download-'))];
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, , 2, 4]);
return [4 /*yield*/, fn(directory)];
case 1:
directory = _b.sent();
_b.label = 2;
case 2:
_b.trys.push([2, 4, , 6]);
return [4 /*yield*/, fn(directory)];
result = _a.sent();
return [3 /*break*/, 4];
case 2: return [4 /*yield*/, fs.remove(directory)];
case 3:
result = _b.sent();
return [3 /*break*/, 6];
case 4:
err_1 = _b.sent();
return [4 /*yield*/, fs.remove(directory)];
case 5:
_b.sent();
throw err_1;
case 6:
_b.trys.push([6, 8, , 9]);
return [4 /*yield*/, fs.remove(directory)];
case 7:
_b.sent();
return [3 /*break*/, 9];
case 8:
_a = _b.sent();
return [3 /*break*/, 9];
case 9: return [2 /*return*/, result];
_a.sent();
return [7 /*endfinally*/];
case 4: return [2 /*return*/, result];
}

@@ -78,2 +63,26 @@ });

}
function withTempDirectoryIn(parentDirectory, fn) {
if (parentDirectory === void 0) { parentDirectory = os.tmpdir(); }
return __awaiter(this, void 0, void 0, function () {
var tempDirectoryPrefix, tempDirectory;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
tempDirectoryPrefix = 'electron-download-';
return [4 /*yield*/, fs.mkdtemp(path.resolve(parentDirectory, tempDirectoryPrefix))];
case 1:
tempDirectory = _a.sent();
return [2 /*return*/, useAndRemoveDirectory(tempDirectory, fn)];
}
});
});
}
exports.withTempDirectoryIn = withTempDirectoryIn;
function withTempDirectory(fn) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, withTempDirectoryIn(undefined, fn)];
});
});
}
exports.withTempDirectory = withTempDirectory;

@@ -80,0 +89,0 @@ function normalizeVersion(version) {

@@ -53,3 +53,3 @@ var __assign = (this && this.__assign) || function () {

import { initializeProxy } from './proxy';
import { withTempDirectory, normalizeVersion, getHostArch, ensureIsTruthyString, isOfficialLinuxIA32Download, } from './utils';
import { withTempDirectoryIn, normalizeVersion, getHostArch, ensureIsTruthyString, isOfficialLinuxIA32Download, } from './utils';
export { getHostArch } from './utils';

@@ -110,3 +110,3 @@ export { initializeProxy } from './proxy';

}
return [4 /*yield*/, withTempDirectory(function (tempFolder) { return __awaiter(_this, void 0, void 0, function () {
return [4 /*yield*/, withTempDirectoryIn(artifactDetails.tempDirectory, function (tempFolder) { return __awaiter(_this, void 0, void 0, function () {
var tempDownloadPath, downloader, _a, shasumPath;

@@ -113,0 +113,0 @@ return __generator(this, function (_b) {

@@ -60,2 +60,7 @@ import { Downloader } from './Downloader';

downloader?: Downloader<any>;
/**
* A temporary directory for downloads.
* It is used before artifacts are put into cache.
*/
tempDirectory?: string;
}

@@ -62,0 +67,0 @@ export declare type ElectronPlatformArtifactDetails = {

@@ -0,1 +1,2 @@

export declare function withTempDirectoryIn<T>(parentDirectory: string | undefined, fn: (directory: string) => Promise<T>): Promise<T>;
export declare function withTempDirectory<T>(fn: (directory: string) => Promise<T>): Promise<T>;

@@ -2,0 +3,0 @@ export declare function normalizeVersion(version: string): string;

@@ -40,33 +40,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import * as path from 'path';
export function withTempDirectory(fn) {
function useAndRemoveDirectory(directory, fn) {
return __awaiter(this, void 0, void 0, function () {
var directory, result, err_1, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-download-'))];
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, , 2, 4]);
return [4 /*yield*/, fn(directory)];
case 1:
directory = _b.sent();
_b.label = 2;
case 2:
_b.trys.push([2, 4, , 6]);
return [4 /*yield*/, fn(directory)];
result = _a.sent();
return [3 /*break*/, 4];
case 2: return [4 /*yield*/, fs.remove(directory)];
case 3:
result = _b.sent();
return [3 /*break*/, 6];
case 4:
err_1 = _b.sent();
return [4 /*yield*/, fs.remove(directory)];
case 5:
_b.sent();
throw err_1;
case 6:
_b.trys.push([6, 8, , 9]);
return [4 /*yield*/, fs.remove(directory)];
case 7:
_b.sent();
return [3 /*break*/, 9];
case 8:
_a = _b.sent();
return [3 /*break*/, 9];
case 9: return [2 /*return*/, result];
_a.sent();
return [7 /*endfinally*/];
case 4: return [2 /*return*/, result];
}

@@ -76,2 +61,25 @@ });

}
export function withTempDirectoryIn(parentDirectory, fn) {
if (parentDirectory === void 0) { parentDirectory = os.tmpdir(); }
return __awaiter(this, void 0, void 0, function () {
var tempDirectoryPrefix, tempDirectory;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
tempDirectoryPrefix = 'electron-download-';
return [4 /*yield*/, fs.mkdtemp(path.resolve(parentDirectory, tempDirectoryPrefix))];
case 1:
tempDirectory = _a.sent();
return [2 /*return*/, useAndRemoveDirectory(tempDirectory, fn)];
}
});
});
}
export function withTempDirectory(fn) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, withTempDirectoryIn(undefined, fn)];
});
});
}
export function normalizeVersion(version) {

@@ -78,0 +86,0 @@ if (!version.startsWith('v')) {

{
"name": "@electron/get",
"version": "1.6.0",
"version": "1.7.0",
"description": "Utility for downloading artifacts from different versions of Electron",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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