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.12.3 to 1.12.4

1

dist/cjs/Cache.d.ts
export declare class Cache {
private cacheRoot;
constructor(cacheRoot?: string);
static getCacheDirectory(downloadUrl: string): string;
getCachePath(downloadUrl: string, fileName: string): string;

@@ -5,0 +6,0 @@ getPathForFileInCache(url: string, fileName: string): Promise<string | null>;

17

dist/cjs/Cache.js

@@ -16,6 +16,6 @@ "use strict";

const env_paths_1 = require("env-paths");
const filenamify = require("filenamify");
const fs = require("fs-extra");
const path = require("path");
const url = require("url");
const crypto = require("crypto");
const d = debug_1.default('@electron/get:cache');

@@ -29,7 +29,14 @@ const defaultCacheRoot = env_paths_1.default('electron', {

}
static getCacheDirectory(downloadUrl) {
const parsedDownloadUrl = url.parse(downloadUrl);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { search, hash, pathname } = parsedDownloadUrl, rest = __rest(parsedDownloadUrl, ["search", "hash", "pathname"]);
const strippedUrl = url.format(Object.assign(Object.assign({}, rest), { pathname: path.dirname(pathname || 'electron') }));
return crypto
.createHash('sha256')
.update(strippedUrl)
.digest('hex');
}
getCachePath(downloadUrl, fileName) {
const _a = url.parse(downloadUrl), { search, hash } = _a, rest = __rest(_a, ["search", "hash"]);
const strippedUrl = url.format(rest);
const sanitizedUrl = filenamify(strippedUrl, { maxLength: 255, replacement: '' });
return path.resolve(this.cacheRoot, sanitizedUrl, fileName);
return path.resolve(this.cacheRoot, Cache.getCacheDirectory(downloadUrl), fileName);
}

@@ -36,0 +43,0 @@ async getPathForFileInCache(url, fileName) {

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

import { DownloadOptions } from './types';
import { Downloader } from './Downloader';
export declare function getDownloaderForSystem(): Promise<Downloader<any>>;
export declare function getDownloaderForSystem(): Promise<Downloader<DownloadOptions>>;

@@ -40,2 +40,3 @@ "use strict";

// https://github.com/visionmedia/node-progress/issues/159
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bar.start = start;

@@ -42,0 +43,0 @@ }

@@ -6,2 +6,9 @@ import { ElectronDownloadRequestOptions, ElectronPlatformArtifactDetailsWithDefaults } from './types';

/**
* Downloads an artifact from an Electron release and returns an absolute path
* to the downloaded file.
*
* @param artifactDetails - The information required to download the artifact
*/
export declare function downloadArtifact(_artifactDetails: ElectronPlatformArtifactDetailsWithDefaults): Promise<string>;
/**
* Downloads a specific version of Electron and returns an absolute path to a

@@ -13,8 +20,1 @@ * ZIP file.

export declare function download(version: string, options?: ElectronDownloadRequestOptions): Promise<string>;
/**
* Downloads an artifact from an Electron release and returns an absolute path
* to the downloaded file.
*
* @param artifactDetails - The information required to download the artifact
*/
export declare function downloadArtifact(_artifactDetails: ElectronPlatformArtifactDetailsWithDefaults): Promise<string>;

@@ -21,12 +21,2 @@ "use strict";

/**
* Downloads a specific version of Electron and returns an absolute path to a
* ZIP file.
*
* @param version - The version of Electron you want to download
*/
function download(version, options) {
return downloadArtifact(Object.assign(Object.assign({}, options), { version, platform: process.platform, arch: process.arch, artifactName: 'electron' }));
}
exports.download = download;
/**
* Downloads an artifact from an Electron release and returns an absolute path

@@ -113,2 +103,12 @@ * to the downloaded file.

exports.downloadArtifact = downloadArtifact;
/**
* Downloads a specific version of Electron and returns an absolute path to a
* ZIP file.
*
* @param version - The version of Electron you want to download
*/
function download(version, options) {
return downloadArtifact(Object.assign(Object.assign({}, options), { version, platform: process.platform, arch: process.arch, artifactName: 'electron' }));
}
exports.download = download;
//# sourceMappingURL=index.js.map
import { Downloader } from './Downloader';
export declare type DownloadOptions = any;
export interface MirrorOptions {

@@ -80,3 +81,3 @@ /**

*/
downloader?: Downloader<any>;
downloader?: Downloader<DownloadOptions>;
/**

@@ -115,2 +116,1 @@ * A temporary directory for downloads.

}) | ElectronGenericArtifactDetails;
export declare type DownloadOptions = any;

@@ -10,11 +10,11 @@ export declare function withTempDirectoryIn<T>(parentDirectory: string | undefined, fn: (directory: string) => Promise<T>): Promise<T>;

* Generates an architecture name that would be used in an Electron or Node.js
* download file name, from the `process` module information.
* download file name.
*/
export declare function getHostArch(): string;
export declare function getNodeArch(arch: string): string;
/**
* Generates an architecture name that would be used in an Electron or Node.js
* download file name.
* download file name, from the `process` module information.
*/
export declare function getNodeArch(arch: string): string;
export declare function getHostArch(): string;
export declare function ensureIsTruthyString<T, K extends keyof T>(obj: T, key: K): void;
export declare function isOfficialLinuxIA32Download(platform: string, arch: string, version: string, mirrorOptions?: object): boolean;

@@ -46,10 +46,2 @@ "use strict";

* Generates an architecture name that would be used in an Electron or Node.js
* download file name, from the `process` module information.
*/
function getHostArch() {
return getNodeArch(process.arch);
}
exports.getHostArch = getHostArch;
/**
* Generates an architecture name that would be used in an Electron or Node.js
* download file name.

@@ -59,2 +51,3 @@ */

if (arch === 'arm') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
switch (process.config.variables.arm_version) {

@@ -71,2 +64,10 @@ case '6':

exports.getNodeArch = getNodeArch;
/**
* Generates an architecture name that would be used in an Electron or Node.js
* download file name, from the `process` module information.
*/
function getHostArch() {
return getNodeArch(process.arch);
}
exports.getHostArch = getHostArch;
function ensureIsTruthyString(obj, key) {

@@ -73,0 +74,0 @@ if (!obj[key] || typeof obj[key] !== 'string') {

export declare class Cache {
private cacheRoot;
constructor(cacheRoot?: string);
static getCacheDirectory(downloadUrl: string): string;
getCachePath(downloadUrl: string, fileName: string): string;

@@ -5,0 +6,0 @@ getPathForFileInCache(url: string, fileName: string): Promise<string | null>;

@@ -14,6 +14,6 @@ var __rest = (this && this.__rest) || function (s, e) {

import envPaths from 'env-paths';
import * as filenamify from 'filenamify';
import * as fs from 'fs-extra';
import * as path from 'path';
import * as url from 'url';
import * as crypto from 'crypto';
const d = debug('@electron/get:cache');

@@ -27,7 +27,14 @@ const defaultCacheRoot = envPaths('electron', {

}
static getCacheDirectory(downloadUrl) {
const parsedDownloadUrl = url.parse(downloadUrl);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { search, hash, pathname } = parsedDownloadUrl, rest = __rest(parsedDownloadUrl, ["search", "hash", "pathname"]);
const strippedUrl = url.format(Object.assign(Object.assign({}, rest), { pathname: path.dirname(pathname || 'electron') }));
return crypto
.createHash('sha256')
.update(strippedUrl)
.digest('hex');
}
getCachePath(downloadUrl, fileName) {
const _a = url.parse(downloadUrl), { search, hash } = _a, rest = __rest(_a, ["search", "hash"]);
const strippedUrl = url.format(rest);
const sanitizedUrl = filenamify(strippedUrl, { maxLength: 255, replacement: '' });
return path.resolve(this.cacheRoot, sanitizedUrl, fileName);
return path.resolve(this.cacheRoot, Cache.getCacheDirectory(downloadUrl), fileName);
}

@@ -34,0 +41,0 @@ async getPathForFileInCache(url, fileName) {

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

import { DownloadOptions } from './types';
import { Downloader } from './Downloader';
export declare function getDownloaderForSystem(): Promise<Downloader<any>>;
export declare function getDownloaderForSystem(): Promise<Downloader<DownloadOptions>>;

@@ -38,2 +38,3 @@ var __rest = (this && this.__rest) || function (s, e) {

// https://github.com/visionmedia/node-progress/issues/159
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bar.start = start;

@@ -40,0 +41,0 @@ }

@@ -6,2 +6,9 @@ import { ElectronDownloadRequestOptions, ElectronPlatformArtifactDetailsWithDefaults } from './types';

/**
* Downloads an artifact from an Electron release and returns an absolute path
* to the downloaded file.
*
* @param artifactDetails - The information required to download the artifact
*/
export declare function downloadArtifact(_artifactDetails: ElectronPlatformArtifactDetailsWithDefaults): Promise<string>;
/**
* Downloads a specific version of Electron and returns an absolute path to a

@@ -13,8 +20,1 @@ * ZIP file.

export declare function download(version: string, options?: ElectronDownloadRequestOptions): Promise<string>;
/**
* Downloads an artifact from an Electron release and returns an absolute path
* to the downloaded file.
*
* @param artifactDetails - The information required to download the artifact
*/
export declare function downloadArtifact(_artifactDetails: ElectronPlatformArtifactDetailsWithDefaults): Promise<string>;

@@ -17,11 +17,2 @@ import debug from 'debug';

/**
* Downloads a specific version of Electron and returns an absolute path to a
* ZIP file.
*
* @param version - The version of Electron you want to download
*/
export function download(version, options) {
return downloadArtifact(Object.assign(Object.assign({}, options), { version, platform: process.platform, arch: process.arch, artifactName: 'electron' }));
}
/**
* Downloads an artifact from an Electron release and returns an absolute path

@@ -107,2 +98,11 @@ * to the downloaded file.

}
/**
* Downloads a specific version of Electron and returns an absolute path to a
* ZIP file.
*
* @param version - The version of Electron you want to download
*/
export function download(version, options) {
return downloadArtifact(Object.assign(Object.assign({}, options), { version, platform: process.platform, arch: process.arch, artifactName: 'electron' }));
}
//# sourceMappingURL=index.js.map
import { Downloader } from './Downloader';
export declare type DownloadOptions = any;
export interface MirrorOptions {

@@ -80,3 +81,3 @@ /**

*/
downloader?: Downloader<any>;
downloader?: Downloader<DownloadOptions>;
/**

@@ -115,2 +116,1 @@ * A temporary directory for downloads.

}) | ElectronGenericArtifactDetails;
export declare type DownloadOptions = any;

@@ -10,11 +10,11 @@ export declare function withTempDirectoryIn<T>(parentDirectory: string | undefined, fn: (directory: string) => Promise<T>): Promise<T>;

* Generates an architecture name that would be used in an Electron or Node.js
* download file name, from the `process` module information.
* download file name.
*/
export declare function getHostArch(): string;
export declare function getNodeArch(arch: string): string;
/**
* Generates an architecture name that would be used in an Electron or Node.js
* download file name.
* download file name, from the `process` module information.
*/
export declare function getNodeArch(arch: string): string;
export declare function getHostArch(): string;
export declare function ensureIsTruthyString<T, K extends keyof T>(obj: T, key: K): void;
export declare function isOfficialLinuxIA32Download(platform: string, arch: string, version: string, mirrorOptions?: object): boolean;

@@ -40,9 +40,2 @@ import * as childProcess from 'child_process';

* Generates an architecture name that would be used in an Electron or Node.js
* download file name, from the `process` module information.
*/
export function getHostArch() {
return getNodeArch(process.arch);
}
/**
* Generates an architecture name that would be used in an Electron or Node.js
* download file name.

@@ -52,2 +45,3 @@ */

if (arch === 'arm') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
switch (process.config.variables.arm_version) {

@@ -63,2 +57,9 @@ case '6':

}
/**
* Generates an architecture name that would be used in an Electron or Node.js
* download file name, from the `process` module information.
*/
export function getHostArch() {
return getNodeArch(process.arch);
}
export function ensureIsTruthyString(obj, key) {

@@ -65,0 +66,0 @@ if (!obj[key] || typeof obj[key] !== 'string') {

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

@@ -13,4 +13,6 @@ "main": "dist/cjs/index.js",

"build:docs": "typedoc --out docs",
"eslint": "eslint --ext .ts src test",
"jest": "jest --coverage",
"lint": "prettier --check \"src/**/*.ts\"",
"lint": "npm run prettier && npm run eslint",
"prettier": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
"prepublishOnly": "npm run build",

@@ -30,3 +32,2 @@ "test": "npm run lint && npm run jest",

"env-paths": "^2.2.0",
"filenamify": "^4.1.0",
"fs-extra": "^8.1.0",

@@ -47,2 +48,8 @@ "got": "^9.6.0",

"@types/semver": "^6.2.0",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "< 24.0.0",
"husky": "^2.3.0",

@@ -57,6 +64,14 @@ "jest": "^24.8.0",

},
"lint-staged": {
"*.ts": [
"prettier --write",
"git add"
"eslintConfig": {
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"prettier",
"prettier/@typescript-eslint"
]

@@ -69,2 +84,9 @@ },

},
"lint-staged": {
"*.ts": [
"eslint --fix",
"prettier --write",
"git add"
]
},
"keywords": [

@@ -81,3 +103,7 @@ "electron",

"global-tunnel-ng": "^2.7.1"
},
"resolutions": {
"eslint/inquirer": "< 7.3.0",
"**/@typescript-eslint/typescript-estree/semver": "^6.3.0"
}
}

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

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

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