Socket
Socket
Sign inDemoInstall

electron-mksnapshot

Package Overview
Dependencies
Maintainers
4
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-mksnapshot - npm Package Compare versions

Comparing version 9.0.1 to 9.0.2

61

download-mksnapshot.js

@@ -1,7 +0,7 @@

var fs = require('fs')
var path = require('path')
var electronDownload = require('electron-download')
var extractZip = require('extract-zip')
var versionToDownload = require('./package').version
var archToDownload = process.env.npm_config_arch
const fs = require('fs')
const path = require('path')
const { downloadArtifact } = require('@electron/get')
const extractZip = require('extract-zip')
const versionToDownload = require('./package').version
let archToDownload = process.env.npm_config_arch

@@ -26,21 +26,23 @@ if (process.arch.indexOf('arm') === 0) {

function download (version, callback) {
electronDownload({
function download (version) {
return downloadArtifact({
version: version,
mksnapshot: true,
artifactName: 'mksnapshot',
platform: process.env.npm_config_platform,
arch: archToDownload,
strictSSL: process.env.npm_config_strict_ssl === 'true',
rejectUnauthorized: process.env.npm_config_strict_ssl === 'true',
quiet: ['info', 'verbose', 'silly', 'http'].indexOf(process.env.npm_config_loglevel) === -1
}, callback)
})
}
function processDownload (err, zipPath) {
if (err != null) throw err
extractZip(zipPath, { dir: path.join(__dirname, 'bin') }, function (error) {
if (error != null) throw error
if (process.platform !== 'win32') {
var mksnapshotPath = path.join(__dirname, 'bin', 'mksnapshot')
async function attemptDownload (version) {
try {
const targetFolder = path.join(__dirname, 'bin')
const zipPath = await download(version)
await extractZip(zipPath, { dir: targetFolder })
const platform = process.env.npm_config_platform || process.platform
if (platform !== 'win32') {
const mksnapshotPath = path.join(__dirname, 'bin', 'mksnapshot')
if (fs.existsSync(mksnapshotPath)) {
fs.chmod(path.join(__dirname, 'bin', 'mksnapshot'), '755', function (error) {
fs.chmod(mksnapshotPath, '755', function (error) {
if (error != null) throw error

@@ -50,13 +52,16 @@ })

}
})
} catch (err) {
// attempt to fall back to semver minor
const parts = version.split('.')
const baseVersion = `${parts[0]}.${parts[1]}.0`
// don't recurse infinitely
if (baseVersion === version) {
throw err
} else {
await attemptDownload(baseVersion)
}
}
}
download(versionToDownload, function (err, zipPath) {
if (err) {
var versionSegments = versionToDownload.split('.')
var baseVersion = versionSegments[0] + '.' + versionSegments[1] + '.0'
download(baseVersion, processDownload)
} else {
processDownload(err, zipPath)
}
})
attemptDownload(versionToDownload)
{
"name": "electron-mksnapshot",
"version": "9.0.1",
"version": "9.0.2",
"description": "Electron version of the mksnapshot binary",

@@ -15,3 +15,3 @@ "repository": "https://github.com/electron/mksnapshot",

"dependencies": {
"electron-download": "^4.1.0",
"@electron/get": "^1.12.2",
"extract-zip": "^2.0.0",

@@ -18,0 +18,0 @@ "fs-extra": "^7.0.1",

@@ -44,2 +44,12 @@ # Electron mksnapshot

```
## Overriding the version downloaded
The version downloaded can be overriden by setting the `ELECTRON_CUSTOM_VERSION` environment variable.
```sh
# Install mksnapshot for Electron v8.3.0
ELECTRON_CUSTOM_VERSION=8.3.0 npm install
```
## Generating snapshots for ARM hardware

@@ -46,0 +56,0 @@

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