{"name":"@electron/get","version":"4.0.1","keywords":["electron","download","prebuild","get","artifact","release"],"author":{"name":"Samuel Attard"},"license":"MIT","_id":"@electron/get@4.0.1","maintainers":[{"name":"electron-cfa","email":"info+cfa-npm@electronjs.org"}],"homepage":"https://github.com/electron/get#readme","bugs":{"url":"https://github.com/electron/get/issues"},"dist":{"shasum":"0a064ccf075fddc4b056a0665dda9aab330d47b5","tarball":"http://registry-npm.ywwl.com/@electron/get/download/@electron/get-4.0.1.tgz","fileCount":30,"integrity":"sha512-fTMFb/ZiK6xQace5YZlhT+vNR08ogat9SqpvwpaC9vD6hgx7ouz9cdcrSrFuNji4823Jmmy90/CDhJq0I4vRFA==","signatures":[{"sig":"MEQCIDfynGtUs6w0HpSyMGOAJm62M98kDkkzJtmXxrQDEgZ5AiAAhL2yJHDgkqjWQcW2Hb0PlJhRXFqJbkGeIpDAtiuDVQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@electron%2fget@4.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":65481,"size":18609,"noattachment":false,"key":"/@electron/get/-/@electron/get-4.0.1.tgz"},"type":"module","husky":{"hooks":{"pre-commit":"lint-staged"}},"engines":{"node":">=22.12.0"},"exports":"./dist/index.js","gitHead":"7024c105a74a1e0d6a9e5120ad9702d22bd9b38c","scripts":{"lint":"npm run prettier && npm run eslint","test":"vitest run --coverage","build":"tsc","eslint":"eslint --ext .ts src test","prepare":"husky","prettier":"prettier --check \"src/**/*.ts\" \"test/**/*.ts\"","build:docs":"npx typedoc","prepublishOnly":"npm run build","prettier:write":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","test:nonetwork":"npm run lint && vitest run --coverage --testPathIgnorePatterns network.spec"},"_npmUser":{"name":"electron-cfa","email":"info+cfa-npm@electronjs.org"},"repository":{"url":"git+https://github.com/electron/get.git","type":"git"},"_npmVersion":"10.9.0","description":"Utility for downloading artifacts from different versions of Electron","directories":{},"lint-staged":{"*.ts":["eslint --fix","prettier --write"]},"_nodeVersion":"22.12.0","dependencies":{"got":"^14.4.5","debug":"^4.1.1","semver":"^7.6.3","progress":"^2.0.3","env-paths":"^3.0.0","sumchecker":"^3.0.1","graceful-fs":"^4.2.11"},"publishConfig":{"provenance":true},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","eslint":"^8.57.0","vitest":"^3.0.5","typedoc":"~0.25.13","prettier":"^3.4.2","typescript":"~5.4.5","@types/node":"~22.10.5","lint-staged":"^15.4.1","@types/debug":"^4.1.4","@types/semver":"^7.5.8","@types/progress":"^2.0.3","@tsconfig/node22":"^22.0.0","@types/graceful-fs":"^4.1.9","@vitest/coverage-v8":"3.0.5","eslint-plugin-import":"^2.31.0","eslint-config-prettier":"^6.15.0","@typescript-eslint/parser":"^8.0.0","@typescript-eslint/eslint-plugin":"^8.19.1","esbuild-plugin-file-path-extensions":"^2.1.4"},"optionalDependencies":{"global-agent":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/get_4.0.1_1748930779769_0.6347340737357008","host":"s3://npm-registry-packages-npm-production"},"readme":"# @electron/get\n\n> Download Electron release artifacts\n\n[![Test](https://github.com/electron/get/actions/workflows/test.yml/badge.svg)](https://github.com/electron/get/actions/workflows/test.yml)\n[![NPM package](https://img.shields.io/npm/v/@electron/get)](https://npm.im/@electron/get)\n[![API docs](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fregistry.npmjs.org%2F%40electron%2Fget%2Flatest&query=%24.version&logo=typescript&logoColor=white&label=API%20Docs\n)](https://packages.electronjs.org/get)\n\n## Usage\n\nFor full API details, see the [API documentation](https://packages.electronjs.org/get).\n\n### Simple: Downloading an Electron Binary ZIP\n\n```typescript\nimport { download } from '@electron/get';\n\n// NB: Use this syntax within an async function, Node does not have support for\n//     top-level await as of Node 12.\nconst zipFilePath = await download('4.0.4');\n```\n\n### Advanced: Downloading a macOS Electron Symbol File\n\n```typescript\nimport { downloadArtifact } from '@electron/get';\n\n// NB: Use this syntax within an async function, Node does not have support for\n//     top-level await as of Node 12.\nconst zipFilePath = await downloadArtifact({\n  version: '4.0.4',\n  platform: 'darwin',\n  artifactName: 'electron',\n  artifactSuffix: 'symbols',\n  arch: 'x64',\n});\n```\n\n### Specifying a mirror\n\nTo specify another location to download Electron assets from, the following options are\navailable:\n\n* `mirrorOptions` Object\n  * `mirror` String (optional) - The base URL of the mirror to download from.\n  * `nightlyMirror` String (optional) - The Electron nightly-specific mirror URL.\n  * `customDir` String (optional) - The name of the directory to download from, often scoped by version number.\n  * `customFilename` String (optional) - The name of the asset to download.\n  * `resolveAssetURL` Function (optional) - A function allowing customization of the url used to download the asset.\n\nAnatomy of a download URL, in terms of `mirrorOptions`:\n\n```\nhttps://github.com/electron/electron/releases/download/v4.0.4/electron-v4.0.4-linux-x64.zip\n|                                                     |       |                           |\n-------------------------------------------------------       -----------------------------\n                        |                                                   |\n              mirror / nightlyMirror                  |    |         customFilename\n                                                       ------\n                                                         ||\n                                                      customDir\n```\n\nExample:\n\n```typescript\nimport { download } from '@electron/get';\n\nconst zipFilePath = await download('4.0.4', {\n  mirrorOptions: {\n    mirror: 'https://mirror.example.com/electron/',\n    customDir: 'custom',\n    customFilename: 'unofficial-electron-linux.zip'\n  }\n});\n// Will download from https://mirror.example.com/electron/custom/unofficial-electron-linux.zip\n\nconst nightlyZipFilePath = await download('8.0.0-nightly.20190901', {\n  mirrorOptions: {\n    nightlyMirror: 'https://nightly.example.com/',\n    customDir: 'nightlies',\n    customFilename: 'nightly-linux.zip'\n  }\n});\n// Will download from https://nightly.example.com/nightlies/nightly-linux.zip\n```\n\n`customDir` can have the placeholder `{{ version }}`, which will be replaced by the version\nspecified (without the leading `v`). For example:\n\n```javascript\nconst zipFilePath = await download('4.0.4', {\n  mirrorOptions: {\n    mirror: 'https://mirror.example.com/electron/',\n    customDir: 'version-{{ version }}',\n    platform: 'linux',\n    arch: 'x64'\n  }\n});\n// Will download from https://mirror.example.com/electron/version-4.0.4/electron-v4.0.4-linux-x64.zip\n```\n\n#### Using environment variables for mirror options\nMirror options can also be specified via the following environment variables:\n* `ELECTRON_CUSTOM_DIR` - Specifies the custom directory to download from.\n* `ELECTRON_CUSTOM_FILENAME` - Specifies the custom file name to download.\n* `ELECTRON_MIRROR` - Specifies the URL of the server to download from if the version is not a nightly version.\n* `ELECTRON_NIGHTLY_MIRROR` - Specifies the URL of the server to download from if the version is a nightly version.\n\n### Overriding the version downloaded\n\nThe version downloaded can be overriden by setting the `ELECTRON_CUSTOM_VERSION` environment variable.\nSetting this environment variable will override the version passed in to `download` or `downloadArtifact`.\n\n## How It Works\n\nThis module downloads Electron to a known place on your system and caches it\nso that future requests for that asset can be returned instantly.  The cache\nlocations are:\n\n* Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`\n* MacOS: `~/Library/Caches/electron/`\n* Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`\n\nBy default, the module uses [`got`](https://github.com/sindresorhus/got) as the\ndownloader. As a result, you can use the same [options](https://github.com/sindresorhus/got#options)\nvia `downloadOptions`.\n\n### Progress Bar\n\nBy default, a progress bar is shown when downloading an artifact for more than 30 seconds. To\ndisable, set the `ELECTRON_GET_NO_PROGRESS` environment variable to any non-empty value, or set\n`quiet` to `true` in `downloadOptions`. If you need to monitor progress yourself via the API, set\n`getProgressCallback` in `downloadOptions`, which has the same function signature as `got`'s\n[`downloadProgress` event callback](https://github.com/sindresorhus/got#ondownloadprogress-progress).\n\n### Proxies\n\nDownstream packages should utilize the `initializeProxy` function to add HTTP(S) proxy support. If\nthe environment variable `ELECTRON_GET_USE_PROXY` is set, it is called automatically.\n\n### Debug\n\n[`debug`](https://www.npmjs.com/package/debug) is used to display logs and messages.\nSet the `DEBUG=@electron/get*` environment variable to log additional\ndebug information from this module.\n","publish_time":1748930779954,"_cnpm_publish_time":1748930779954,"dist-tags":{"latest":"5.1.0"}}