@nwutils/getter 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nwutils/getter",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Get NW.js and related binaries for Linux, MacOS and Windows.",
5
5
  "keywords": [
6
6
  "NW.js",
@@ -30,7 +30,8 @@
30
30
  "type": "module",
31
31
  "files": [
32
32
  "LICENSE",
33
- "src"
33
+ "src",
34
+ "types"
34
35
  ],
35
36
  "homepage": "https://github.com/nwutils/getter",
36
37
  "repository": {
@@ -47,18 +48,18 @@
47
48
  "npm": "11.7.0"
48
49
  },
49
50
  "dependencies": {
50
- "semver": "^7.7.3",
51
- "tar": "^7.5.4",
51
+ "semver": "^7.7.4",
52
+ "tar": "^7.5.11",
52
53
  "yauzl-promise": "^4.0.0"
53
54
  },
54
55
  "devDependencies": {
55
- "@eslint/js": "^9.39.2",
56
- "@types/node": "^25.0.10",
56
+ "@eslint/js": "^10.0.1",
57
+ "@types/node": "^25.3.3",
57
58
  "@types/semver": "^7.7.1",
58
59
  "@types/yauzl-promise": "^4.0.1",
59
- "eslint": "^9.39.2",
60
- "eslint-plugin-jsdoc": "^62.1.0",
61
- "globals": "^17.0.0",
60
+ "eslint": "^10.0.2",
61
+ "eslint-plugin-jsdoc": "^62.7.1",
62
+ "globals": "^17.4.0",
62
63
  "typescript": "^5.9.3"
63
64
  }
64
65
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Decompresses a file at `filePath` to `cacheDir` directory.
3
+ * @async
4
+ * @function
5
+ * @param {string} filePath - file path to compressed binary
6
+ * @param {string} cacheDir - directory to decompress into
7
+ * @throws {Error}
8
+ * @returns {Promise<void>}
9
+ */
10
+ export default function decompress(filePath: string, cacheDir: string): Promise<void>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Download community FFmpeg binary from `https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt`.
3
+ * @async
4
+ * @function
5
+ * @param {string} downloadUrl - Download server
6
+ * @param {string} version - Runtime version
7
+ * @param {string} platform - NW supported platform
8
+ * @param {string} arch - NW supported architecture
9
+ * @param {string} cacheDir - Directory to store FFmpeg binary
10
+ * @throws {Error} - When download fails
11
+ * @returns {Promise<string>} - Path of compressed file which containscommunity FFmpeg binary.
12
+ */
13
+ export default function ffmpeg(downloadUrl: string, version: string, platform: string, arch: string, cacheDir: string): Promise<string>;
@@ -0,0 +1,69 @@
1
+ export default get;
2
+ export type Options = {
3
+ /**
4
+ * Runtime version
5
+ */
6
+ version: string | "latest" | "stable" | "lts";
7
+ /**
8
+ * Build flavor
9
+ */
10
+ flavor: "normal" | "sdk";
11
+ /**
12
+ * Target platform
13
+ */
14
+ platform: "linux" | "osx" | "win";
15
+ /**
16
+ * Target architecture
17
+ */
18
+ arch: "ia32" | "x64" | "arm64";
19
+ /**
20
+ * Download server, accepts http and https
21
+ */
22
+ downloadUrl: "https://dl.nwjs.io";
23
+ /**
24
+ * Manifest URI, accepts file, http and https
25
+ */
26
+ manifestUrl: "https://nwjs.io/versions.json";
27
+ /**
28
+ * Cache directory
29
+ */
30
+ cacheDir: string;
31
+ /**
32
+ * If false, remove cache and redownload.
33
+ */
34
+ cache: boolean;
35
+ /**
36
+ * If true, ffmpeg is not downloaded.
37
+ */
38
+ ffmpeg: boolean;
39
+ /**
40
+ * If true, download node headers.
41
+ */
42
+ nativeAddon: boolean;
43
+ /**
44
+ * If true shasum is enabled, otherwise disabled.
45
+ */
46
+ shaSum: boolean;
47
+ };
48
+ /**
49
+ * @typedef {object} Options
50
+ * @property {string | "latest" | "stable" | "lts"} version Runtime version
51
+ * @property {"normal" | "sdk"} flavor Build flavor
52
+ * @property {"linux" | "osx" | "win"} platform Target platform
53
+ * @property {"ia32" | "x64" | "arm64"} arch Target architecture
54
+ * @property {"https://dl.nwjs.io"} downloadUrl Download server, accepts http and https
55
+ * @property {"https://nwjs.io/versions.json"} manifestUrl Manifest URI, accepts file, http and https
56
+ * @property {string} cacheDir Cache directory
57
+ * @property {boolean} cache If false, remove cache and redownload.
58
+ * @property {boolean} ffmpeg If true, ffmpeg is not downloaded.
59
+ * @property {boolean} nativeAddon If true, download node headers.
60
+ * @property {boolean} shaSum If true shasum is enabled, otherwise disabled.
61
+ */
62
+ /**
63
+ * Get NW.js and related binaries for Linux, MacOS and Windows.
64
+ * @async
65
+ * @function
66
+ * @param {Options} options Get mode options
67
+ * @returns {Promise<void>}
68
+ */
69
+ declare function get(options: Options): Promise<void>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Download NW.js's Node.js headers.
3
+ * @async
4
+ * @function
5
+ * @param {string} downloadUrl - Download server
6
+ * @param {string} version - Runtime version
7
+ * @param {string} cacheDir - Directory to store NW binaries
8
+ * @throws {Error} - When download fails
9
+ * @returns {Promise<string>} - path of compressed file which contains the Node headers.
10
+ */
11
+ export default function nw(downloadUrl: string, version: string, cacheDir: string): Promise<string>;
package/types/nw.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Download NW.js binary.
3
+ * @async
4
+ * @function
5
+ * @param {string} downloadUrl - Download server
6
+ * @param {string} version - Runtime version
7
+ * @param {string} flavor - Runtime build flavor
8
+ * @param {string} platform - NW supported platform
9
+ * @param {string} arch - NW supported architecture
10
+ * @param {string} cacheDir - Directory to store NW binaries
11
+ * @throws {Error} - When download fails
12
+ * @returns {Promise<string>} - Path of compressed file which contains NW.js binaries.
13
+ */
14
+ export default function nw(downloadUrl: string, version: string, flavor: string, platform: string, arch: string, cacheDir: string): Promise<string>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Download from `url` and save at `filePath`.
3
+ * @param {string} url
4
+ * @param {string} filePath
5
+ * @returns {Promise<void>}
6
+ */
7
+ export default function request(url: string, filePath: string): Promise<void>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Verify the SHA256 checksum of downloaded artifacts.
3
+ * @async
4
+ * @function
5
+ * @param {string} shaUrl - URL to get the shasum text file from.
6
+ * @param {string} shaOut - File path to shasum text file.
7
+ * @param {string} cacheDir - File path to cache directory.
8
+ * @param {boolean} ffmpeg - Toggle between community (true) and official (false) ffmpeg binary
9
+ * @param {boolean} shaSum - Throws error if true, otherwise logs a warning.
10
+ * @throws {Error}
11
+ * @returns {Promise<boolean>} - Returns true if the checksums match.
12
+ */
13
+ export default function verify(shaUrl: string, shaOut: string, cacheDir: string, ffmpeg: boolean, shaSum: boolean): Promise<boolean>;