node-av 7.0.0-beta.2 → 7.0.0
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/README.md +23 -9
- package/dist/ffmpeg/index.d.ts +12 -13
- package/dist/ffmpeg/index.js +62 -21
- package/dist/ffmpeg/index.js.map +1 -1
- package/dist/lib/binding.js +3 -2
- package/dist/lib/binding.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/libc.d.ts +11 -0
- package/dist/utils/libc.js +35 -0
- package/dist/utils/libc.js.map +1 -0
- package/install/check.js +3 -8
- package/package.json +14 -13
- package/dist/ffmpeg/install.d.ts +0 -2
- package/dist/ffmpeg/install.js +0 -253
- package/dist/ffmpeg/install.js.map +0 -1
- package/dist/ffmpeg/utils.d.ts +0 -47
- package/dist/ffmpeg/utils.js +0 -92
- package/dist/ffmpeg/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -55,6 +55,12 @@ Native Node.js bindings for FFmpeg with full TypeScript support - including type
|
|
|
55
55
|
npm install node-av
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
The FFmpeg command-line tool is a separate, optional package (see [FFmpeg Binary Access](#ffmpeg-binary-access)):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install @seydx/node-av-ffmpeg
|
|
62
|
+
```
|
|
63
|
+
|
|
58
64
|
## Quick Start
|
|
59
65
|
|
|
60
66
|
### Low-Level API
|
|
@@ -388,7 +394,11 @@ await using screen2 = await DeviceAPI.openScreen({
|
|
|
388
394
|
|
|
389
395
|
## FFmpeg Binary Access
|
|
390
396
|
|
|
391
|
-
Need
|
|
397
|
+
Need the FFmpeg command-line tool as well? Install `@seydx/node-av-ffmpeg` next to `node-av`. npm installs only the binary for your platform, built from the same FFmpeg as the native bindings, and `node-av/ffmpeg` finds it:
|
|
398
|
+
|
|
399
|
+
```bash
|
|
400
|
+
npm install node-av @seydx/node-av-ffmpeg
|
|
401
|
+
```
|
|
392
402
|
|
|
393
403
|
```typescript
|
|
394
404
|
import { ffmpegPath, isFfmpegAvailable } from 'node-av/ffmpeg';
|
|
@@ -405,7 +415,7 @@ if (isFfmpegAvailable()) {
|
|
|
405
415
|
const { stdout } = await execFileAsync(ffmpegPath(), ['-version']);
|
|
406
416
|
console.log(stdout);
|
|
407
417
|
} else {
|
|
408
|
-
console.log('FFmpeg binary not available -
|
|
418
|
+
console.log('FFmpeg binary not available - run: npm install @seydx/node-av-ffmpeg');
|
|
409
419
|
}
|
|
410
420
|
|
|
411
421
|
// Direct usage example
|
|
@@ -422,7 +432,7 @@ async function convertVideo(input: string, output: string) {
|
|
|
422
432
|
}
|
|
423
433
|
```
|
|
424
434
|
|
|
425
|
-
|
|
435
|
+
`ffmpegPath()` throws if the package is not installed, so check `isFfmpegAvailable()` first when the CLI is optional. In Electron apps, unpack `node_modules/@seydx/**` from the ASAR archive so the binary can be executed.
|
|
426
436
|
|
|
427
437
|
## Resource Management
|
|
428
438
|
|
|
@@ -551,22 +561,26 @@ The repository ships 60+ runnable examples covering both API levels — high-lev
|
|
|
551
561
|
Prebuilt binaries are available for multiple platforms:
|
|
552
562
|
|
|
553
563
|
- **macOS**: x64, ARM64
|
|
554
|
-
- **Linux**: x64, ARM64
|
|
564
|
+
- **Linux**: x64, ARM64 (glibc and musl, e.g. Alpine)
|
|
555
565
|
- **Windows**: x64, ARM64
|
|
556
566
|
|
|
557
567
|
### Cross-Platform Packaging (CI/CD)
|
|
558
568
|
|
|
559
|
-
By default
|
|
560
|
-
|
|
561
|
-
|
|
569
|
+
By default npm installs the native binding (and the FFmpeg binary, if
|
|
570
|
+
`@seydx/node-av-ffmpeg` is installed) for the host platform. When packaging for
|
|
571
|
+
a different target (e.g. building a Windows Electron app from a Linux CI
|
|
572
|
+
runner), pass npm's standard `--os` / `--cpu` / `--libc` flags:
|
|
562
573
|
|
|
563
574
|
```bash
|
|
564
575
|
# Install Windows x64 binaries while running on Linux
|
|
565
576
|
npm install --os=win32 --cpu=x64
|
|
577
|
+
|
|
578
|
+
# Install the musl binaries for an Alpine image while running on a glibc Linux
|
|
579
|
+
npm install --os=linux --cpu=x64 --libc=musl
|
|
566
580
|
```
|
|
567
581
|
|
|
568
|
-
npm filters the platform-specific `optionalDependencies`
|
|
569
|
-
|
|
582
|
+
npm filters the platform-specific `optionalDependencies` of both packages by
|
|
583
|
+
these flags.
|
|
570
584
|
|
|
571
585
|
## Troubleshooting
|
|
572
586
|
|
package/dist/ffmpeg/index.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get the absolute path to the FFmpeg binary.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The binary ships in the optional `@seydx/node-av-ffmpeg` package
|
|
5
|
+
* (`npm install @seydx/node-av-ffmpeg`), which installs the build for the
|
|
6
|
+
* current platform. It is built from the same FFmpeg as the native bindings.
|
|
7
|
+
* In Electron apps the path points into `app.asar.unpacked`.
|
|
7
8
|
*
|
|
8
9
|
* @returns Absolute path to the FFmpeg binary
|
|
9
10
|
*
|
|
11
|
+
* @throws {Error} If `@seydx/node-av-ffmpeg` is not installed or has no build for this platform
|
|
12
|
+
*
|
|
10
13
|
* @example
|
|
11
14
|
* ```typescript
|
|
12
15
|
* import { ffmpegPath } from 'node-av/ffmpeg';
|
|
13
16
|
*
|
|
14
17
|
* const path = ffmpegPath();
|
|
15
18
|
* console.log('FFmpeg binary at:', path);
|
|
16
|
-
* //
|
|
17
|
-
* // On Unix: /path/to/node_modules/node-av/binary/ffmpeg
|
|
19
|
+
* // e.g. /path/to/node_modules/@seydx/node-av-ffmpeg-linux-x64/ffmpeg
|
|
18
20
|
* ```
|
|
19
21
|
*
|
|
20
22
|
* @example Convert video using FFmpeg binary
|
|
@@ -40,13 +42,12 @@
|
|
|
40
42
|
*/
|
|
41
43
|
export declare function ffmpegPath(): string;
|
|
42
44
|
/**
|
|
43
|
-
* Check if the FFmpeg binary is available
|
|
45
|
+
* Check if the FFmpeg binary is available.
|
|
44
46
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* before attempting to use the binary.
|
|
47
|
+
* Returns whether `@seydx/node-av-ffmpeg` is installed with a build for
|
|
48
|
+
* this platform, i.e. whether {@link ffmpegPath} will succeed.
|
|
48
49
|
*
|
|
49
|
-
* @returns `true` if FFmpeg binary exists, `false` otherwise
|
|
50
|
+
* @returns `true` if the FFmpeg binary exists, `false` otherwise
|
|
50
51
|
*
|
|
51
52
|
* @example
|
|
52
53
|
* ```typescript
|
|
@@ -56,9 +57,7 @@ export declare function ffmpegPath(): string;
|
|
|
56
57
|
* console.log('FFmpeg is ready to use');
|
|
57
58
|
* // Safe to use ffmpegPath() and execute FFmpeg commands
|
|
58
59
|
* } else {
|
|
59
|
-
* console.log('FFmpeg binary not found');
|
|
60
|
-
* console.log('Expected location:', ffmpegPath());
|
|
61
|
-
* console.log('Try running: npm install node-av');
|
|
60
|
+
* console.log('FFmpeg binary not found, run: npm install @seydx/node-av-ffmpeg');
|
|
62
61
|
* }
|
|
63
62
|
* ```
|
|
64
63
|
*
|
package/dist/ffmpeg/index.js
CHANGED
|
@@ -1,29 +1,69 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { getDirname, getUnpackedPath } from '../utils/electron.js';
|
|
5
|
+
import { isMusl } from '../utils/libc.js';
|
|
5
6
|
import { FFMPEG_VERSION } from './version.js';
|
|
6
7
|
const __dirname = getDirname(import.meta.url);
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const FFMPEG_PACKAGE = '@seydx/node-av-ffmpeg';
|
|
10
|
+
const ffmpegFile = 'ffmpeg' + (process.platform === 'win32' ? '.exe' : '');
|
|
11
|
+
// Local build (development, CI tests): binary/ next to dist/
|
|
12
|
+
const localFfmpegPath = resolve(__dirname, '../../binary', ffmpegFile);
|
|
13
|
+
let resolvedFfmpegPath = null;
|
|
14
|
+
/**
|
|
15
|
+
* Find the FFmpeg binary.
|
|
16
|
+
*
|
|
17
|
+
* Checks the local `binary/` folder first, then the platform package installed by `@seydx/node-av-ffmpeg`.
|
|
18
|
+
*
|
|
19
|
+
* @returns Absolute path to the binary, or `null` if neither is installed
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
function findFfmpeg() {
|
|
24
|
+
if (resolvedFfmpegPath) {
|
|
25
|
+
return resolvedFfmpegPath;
|
|
26
|
+
}
|
|
27
|
+
if (existsSync(localFfmpegPath)) {
|
|
28
|
+
resolvedFfmpegPath = localFfmpegPath;
|
|
29
|
+
return resolvedFfmpegPath;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
// The platform package is a dependency of the meta package, not of node-av, so it is
|
|
33
|
+
// resolved from there (strict layouts like pnpm don't expose it to node-av directly).
|
|
34
|
+
const metaPackageJson = require.resolve(`${FFMPEG_PACKAGE}/package.json`);
|
|
35
|
+
const platformPackage = `${FFMPEG_PACKAGE}-${process.platform}-${process.arch}${isMusl() ? '-musl' : ''}`;
|
|
36
|
+
const platformPackageJson = createRequire(metaPackageJson).resolve(`${platformPackage}/package.json`);
|
|
37
|
+
const path = getUnpackedPath(join(dirname(platformPackageJson), ffmpegFile));
|
|
38
|
+
if (existsSync(path)) {
|
|
39
|
+
resolvedFfmpegPath = path;
|
|
40
|
+
return resolvedFfmpegPath;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Not installed, or no build for this platform
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
10
48
|
/**
|
|
11
49
|
* Get the absolute path to the FFmpeg binary.
|
|
12
50
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
51
|
+
* The binary ships in the optional `@seydx/node-av-ffmpeg` package
|
|
52
|
+
* (`npm install @seydx/node-av-ffmpeg`), which installs the build for the
|
|
53
|
+
* current platform. It is built from the same FFmpeg as the native bindings.
|
|
54
|
+
* In Electron apps the path points into `app.asar.unpacked`.
|
|
16
55
|
*
|
|
17
56
|
* @returns Absolute path to the FFmpeg binary
|
|
18
57
|
*
|
|
58
|
+
* @throws {Error} If `@seydx/node-av-ffmpeg` is not installed or has no build for this platform
|
|
59
|
+
*
|
|
19
60
|
* @example
|
|
20
61
|
* ```typescript
|
|
21
62
|
* import { ffmpegPath } from 'node-av/ffmpeg';
|
|
22
63
|
*
|
|
23
64
|
* const path = ffmpegPath();
|
|
24
65
|
* console.log('FFmpeg binary at:', path);
|
|
25
|
-
* //
|
|
26
|
-
* // On Unix: /path/to/node_modules/node-av/binary/ffmpeg
|
|
66
|
+
* // e.g. /path/to/node_modules/@seydx/node-av-ffmpeg-linux-x64/ffmpeg
|
|
27
67
|
* ```
|
|
28
68
|
*
|
|
29
69
|
* @example Convert video using FFmpeg binary
|
|
@@ -48,16 +88,19 @@ const ffmpegExtractedFilePath = resolve(ffmpegBinaryPath, ffmpegFile);
|
|
|
48
88
|
* ```
|
|
49
89
|
*/
|
|
50
90
|
export function ffmpegPath() {
|
|
51
|
-
|
|
91
|
+
const path = findFfmpeg();
|
|
92
|
+
if (!path) {
|
|
93
|
+
throw new Error(`FFmpeg binary not found for ${process.platform}-${process.arch}. Install it with: npm install ${FFMPEG_PACKAGE}`);
|
|
94
|
+
}
|
|
95
|
+
return path;
|
|
52
96
|
}
|
|
53
97
|
/**
|
|
54
|
-
* Check if the FFmpeg binary is available
|
|
98
|
+
* Check if the FFmpeg binary is available.
|
|
55
99
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* before attempting to use the binary.
|
|
100
|
+
* Returns whether `@seydx/node-av-ffmpeg` is installed with a build for
|
|
101
|
+
* this platform, i.e. whether {@link ffmpegPath} will succeed.
|
|
59
102
|
*
|
|
60
|
-
* @returns `true` if FFmpeg binary exists, `false` otherwise
|
|
103
|
+
* @returns `true` if the FFmpeg binary exists, `false` otherwise
|
|
61
104
|
*
|
|
62
105
|
* @example
|
|
63
106
|
* ```typescript
|
|
@@ -67,9 +110,7 @@ export function ffmpegPath() {
|
|
|
67
110
|
* console.log('FFmpeg is ready to use');
|
|
68
111
|
* // Safe to use ffmpegPath() and execute FFmpeg commands
|
|
69
112
|
* } else {
|
|
70
|
-
* console.log('FFmpeg binary not found');
|
|
71
|
-
* console.log('Expected location:', ffmpegPath());
|
|
72
|
-
* console.log('Try running: npm install node-av');
|
|
113
|
+
* console.log('FFmpeg binary not found, run: npm install @seydx/node-av-ffmpeg');
|
|
73
114
|
* }
|
|
74
115
|
* ```
|
|
75
116
|
*
|
|
@@ -94,7 +135,7 @@ export function ffmpegPath() {
|
|
|
94
135
|
* ```
|
|
95
136
|
*/
|
|
96
137
|
export function isFfmpegAvailable() {
|
|
97
|
-
return
|
|
138
|
+
return findFfmpeg() !== null;
|
|
98
139
|
}
|
|
99
140
|
/**
|
|
100
141
|
* Get the FFmpeg version used by the binary.
|
package/dist/ffmpeg/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffmpeg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffmpeg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OA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AAC,OAAO,CAAC,GAAG,eAAe,eAAe,CAAC,CAAC;QACtG,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;QAC7E,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,kBAAkB,GAAG,IAAI,CAAC;YAC1B,OAAO,kBAAkB,CAAC;QAC5B,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,+CAA+C;IACjD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;IAC1B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,+BAA+B,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,kCAAkC,cAAc,EAAE,CAAC,CAAC;IACrI,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,UAAU,EAAE,KAAK,IAAI,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/dist/lib/binding.js
CHANGED
|
@@ -9,6 +9,7 @@ import { createRequire } from 'node:module';
|
|
|
9
9
|
import { resolve } from 'node:path';
|
|
10
10
|
import { isMainThread } from 'node:worker_threads';
|
|
11
11
|
import { getDirname } from '../utils/electron.js';
|
|
12
|
+
import { isMusl } from '../utils/libc.js';
|
|
12
13
|
const __dirname = getDirname(import.meta.url);
|
|
13
14
|
/**
|
|
14
15
|
* Load the native binding
|
|
@@ -64,9 +65,9 @@ function loadBinding() {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
else {
|
|
67
|
-
// Non-Windows platforms
|
|
68
|
+
// Non-Windows platforms. musl (Alpine) needs its own build, a glibc one doesn't load there.
|
|
68
69
|
try {
|
|
69
|
-
const packageName = `@seydx/node-av-${platformArch}`;
|
|
70
|
+
const packageName = `@seydx/node-av-${platformArch}${isMusl() ? '-musl' : ''}`;
|
|
70
71
|
return require(`${packageName}/node-av.node`);
|
|
71
72
|
}
|
|
72
73
|
catch (err) {
|
package/dist/lib/binding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/lib/binding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/lib/binding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAkD1C,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAmT9C;;;;;;GAMG;AACH,SAAS,WAAW;IAClB,MAAM,OAAO,GAAG,aAAa,C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,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9C,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check whether this Node.js runs on musl libc (Alpine Linux and other musl distributions).
|
|
3
|
+
*
|
|
4
|
+
* Only a glibc build of Node.js carries a glibc runtime version in its diagnostic report.
|
|
5
|
+
* Network details are left out of the report, resolving open sockets can take seconds.
|
|
6
|
+
*
|
|
7
|
+
* @returns True on Linux with a musl build of Node.js
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function isMusl(): boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
let musl;
|
|
2
|
+
/**
|
|
3
|
+
* Check whether this Node.js runs on musl libc (Alpine Linux and other musl distributions).
|
|
4
|
+
*
|
|
5
|
+
* Only a glibc build of Node.js carries a glibc runtime version in its diagnostic report.
|
|
6
|
+
* Network details are left out of the report, resolving open sockets can take seconds.
|
|
7
|
+
*
|
|
8
|
+
* @returns True on Linux with a musl build of Node.js
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export function isMusl() {
|
|
13
|
+
if (musl !== undefined) {
|
|
14
|
+
return musl;
|
|
15
|
+
}
|
|
16
|
+
musl = false;
|
|
17
|
+
if (process.platform !== 'linux') {
|
|
18
|
+
return musl;
|
|
19
|
+
}
|
|
20
|
+
const report = process.report;
|
|
21
|
+
const excludeNetwork = report.excludeNetwork;
|
|
22
|
+
try {
|
|
23
|
+
report.excludeNetwork = true;
|
|
24
|
+
const { header } = report.getReport();
|
|
25
|
+
musl = !header?.glibcVersionRuntime;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// No report available, assume glibc
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
report.excludeNetwork = excludeNetwork;
|
|
32
|
+
}
|
|
33
|
+
return musl;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=libc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libc.js","sourceRoot":"","sources":["../../src/utils/libc.ts"],"names":[],"mappings":"AAAA,IAAI,IAAyB,CAAC;AAE9B;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM;IACpB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,GAAG,KAAK,CAAC;IACb,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,MAA6D,CAAC;IACrF,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,IAAI,CAAC;QACH,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;QAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,SAAS,EAAmD,CAAC;QACvF,IAAI,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,oCAAoC;IACtC,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/install/check.js
CHANGED
|
@@ -41,7 +41,8 @@ const tryLoadPrebuilt = () => {
|
|
|
41
41
|
// Package not installed
|
|
42
42
|
}
|
|
43
43
|
} else {
|
|
44
|
-
|
|
44
|
+
// musl (Alpine) has its own build, a glibc one doesn't load there
|
|
45
|
+
const packageName = `@seydx/node-av-${platform}-${arch}${isMuslLibc() ? '-musl' : ''}`;
|
|
45
46
|
|
|
46
47
|
try {
|
|
47
48
|
// Check if the package is installed (don't check for .node file yet - it may be extracted by postinstall)
|
|
@@ -80,13 +81,7 @@ const isMuslLibc = () => {
|
|
|
80
81
|
|
|
81
82
|
const noPrebuiltError = () => {
|
|
82
83
|
log('');
|
|
83
|
-
log(`No prebuilt binary available for ${process.platform}-${process.arch}.`);
|
|
84
|
-
|
|
85
|
-
if (isMuslLibc()) {
|
|
86
|
-
log('Note: You appear to be on a musl-based system (e.g. Alpine Linux).');
|
|
87
|
-
log('Prebuilt binaries are only provided for glibc-based Linux distributions.');
|
|
88
|
-
}
|
|
89
|
-
|
|
84
|
+
log(`No prebuilt binary available for ${process.platform}-${process.arch}${isMuslLibc() ? ' (musl)' : ''}.`);
|
|
90
85
|
log('The published npm package does not contain the native sources,');
|
|
91
86
|
log('so it cannot be built from source inside node_modules.');
|
|
92
87
|
log('To build from source, clone the repository and follow the build instructions:');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-av",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "FFmpeg bindings for Node.js",
|
|
5
5
|
"author": "seydx (https://github.com/seydx/node-av)",
|
|
6
6
|
"type": "module",
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
"lint:fix": "eslint --fix .",
|
|
80
80
|
"lint:gyp": "node scripts/check-gyp-sync.js",
|
|
81
81
|
"patch:ffmpeg": "node scripts/patch-ffmpeg.js",
|
|
82
|
-
"postinstall": "node dist/ffmpeg/install.js",
|
|
83
82
|
"predocs": "typedoc && cpy README.md docs/ --rename=index.md",
|
|
84
83
|
"release:patch": "npm run build:tsc && node scripts/prepare-release.js patch",
|
|
85
84
|
"release:minor": "npm run build:tsc && node scripts/prepare-release.js minor",
|
|
@@ -91,21 +90,24 @@
|
|
|
91
90
|
"test:all": "npm run build:tests && npm run build:tsc && tsx --test test/*.test.ts",
|
|
92
91
|
"update": "updates --update ./"
|
|
93
92
|
},
|
|
94
|
-
"dependencies": {
|
|
95
|
-
"unzipper": "^0.12.5"
|
|
96
|
-
},
|
|
97
93
|
"optionalDependencies": {
|
|
98
|
-
"@seydx/node-av-darwin-arm64": "7.0.0
|
|
99
|
-
"@seydx/node-av-darwin-x64": "7.0.0
|
|
100
|
-
"@seydx/node-av-linux-arm64": "7.0.0
|
|
101
|
-
"@seydx/node-av-linux-
|
|
102
|
-
"@seydx/node-av-
|
|
103
|
-
"@seydx/node-av-
|
|
94
|
+
"@seydx/node-av-darwin-arm64": "7.0.0",
|
|
95
|
+
"@seydx/node-av-darwin-x64": "7.0.0",
|
|
96
|
+
"@seydx/node-av-linux-arm64": "7.0.0",
|
|
97
|
+
"@seydx/node-av-linux-arm64-musl": "7.0.0",
|
|
98
|
+
"@seydx/node-av-linux-x64": "7.0.0",
|
|
99
|
+
"@seydx/node-av-linux-x64-musl": "7.0.0",
|
|
100
|
+
"@seydx/node-av-win32-arm64-msvc": "7.0.0",
|
|
101
|
+
"@seydx/node-av-win32-x64-msvc": "7.0.0"
|
|
104
102
|
},
|
|
105
103
|
"peerDependencies": {
|
|
104
|
+
"@seydx/node-av-ffmpeg": "*",
|
|
106
105
|
"werift": ">=0.24.3"
|
|
107
106
|
},
|
|
108
107
|
"peerDependenciesMeta": {
|
|
108
|
+
"@seydx/node-av-ffmpeg": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
109
111
|
"werift": {
|
|
110
112
|
"optional": true
|
|
111
113
|
}
|
|
@@ -115,7 +117,6 @@
|
|
|
115
117
|
"@types/node": "^26.6.6",
|
|
116
118
|
"@types/node-abi": "^3.0.3",
|
|
117
119
|
"@types/semver": "^7.8.0",
|
|
118
|
-
"@types/unzipper": "^0.10.11",
|
|
119
120
|
"@types/ws": "^8.18.2",
|
|
120
121
|
"@typescript-eslint/parser": "^8.72.2",
|
|
121
122
|
"concurrently": "^10.0.7",
|
|
@@ -126,7 +127,7 @@
|
|
|
126
127
|
"globals": "^17.14.0",
|
|
127
128
|
"node-addon-api": "^8.9.2",
|
|
128
129
|
"node-gyp": "^13.1.0",
|
|
129
|
-
"prettier": "^3.
|
|
130
|
+
"prettier": "^3.10.1",
|
|
130
131
|
"rimraf": "^6.1.4",
|
|
131
132
|
"sharp": "^0.35.5",
|
|
132
133
|
"tsx": "^4.23.15",
|
package/dist/ffmpeg/install.d.ts
DELETED
package/dist/ffmpeg/install.js
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createHash } from 'node:crypto';
|
|
3
|
-
import { chmodSync, createReadStream, createWriteStream, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { rename } from 'node:fs/promises';
|
|
5
|
-
import { createRequire } from 'node:module';
|
|
6
|
-
import { dirname, extname, resolve } from 'node:path';
|
|
7
|
-
import { Readable } from 'node:stream';
|
|
8
|
-
import { pipeline } from 'node:stream/promises';
|
|
9
|
-
import { fileURLToPath } from 'node:url';
|
|
10
|
-
import { Open } from 'unzipper';
|
|
11
|
-
import { ffmpegPath } from './index.js';
|
|
12
|
-
import { getArchitecture, getPlatform, useMingwToolchain } from './utils.js';
|
|
13
|
-
import { FFMPEG_VERSION } from './version.js';
|
|
14
|
-
if (process.env.SKIP_FFMPEG === 'true') {
|
|
15
|
-
console.log('Skipping ffmpeg download');
|
|
16
|
-
process.exit(0);
|
|
17
|
-
}
|
|
18
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
-
const __dirname = dirname(__filename);
|
|
20
|
-
const __require = createRequire(import.meta.url);
|
|
21
|
-
const releasesUrl = 'https://api.github.com/repos/seydx/node-av/releases';
|
|
22
|
-
const releaseDownloadBase = 'https://github.com/seydx/node-av/releases/download';
|
|
23
|
-
const pJson = __require('../../package.json');
|
|
24
|
-
const ffmpegVersion = `v${FFMPEG_VERSION}`;
|
|
25
|
-
// Number of retries per download URL (in addition to the initial attempt).
|
|
26
|
-
const DOWNLOAD_RETRIES = 2;
|
|
27
|
-
const binaries = {
|
|
28
|
-
darwin: {
|
|
29
|
-
x64: `ffmpeg-${ffmpegVersion}-macos-x64-jellyfin.zip`,
|
|
30
|
-
arm64: `ffmpeg-${ffmpegVersion}-macos-arm64-jellyfin.zip`,
|
|
31
|
-
},
|
|
32
|
-
linux: {
|
|
33
|
-
x64: `ffmpeg-${ffmpegVersion}-linux-x64-jellyfin.zip`,
|
|
34
|
-
arm64: `ffmpeg-${ffmpegVersion}-linux-arm64-jellyfin.zip`,
|
|
35
|
-
},
|
|
36
|
-
win32: {
|
|
37
|
-
x64: `ffmpeg-${ffmpegVersion}-win-x64.zip`,
|
|
38
|
-
arm64: `ffmpeg-${ffmpegVersion}-win-arm64.zip`,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
const arch = getArchitecture();
|
|
42
|
-
const sysPlatform = getPlatform();
|
|
43
|
-
let filename = binaries[sysPlatform]?.[arch];
|
|
44
|
-
if (!filename) {
|
|
45
|
-
console.warn(`Warning: No ffmpeg binary found for architecture (${sysPlatform} / ${arch})`);
|
|
46
|
-
console.warn('FFmpeg binary installation will be skipped.');
|
|
47
|
-
process.exit(0);
|
|
48
|
-
}
|
|
49
|
-
// Standard (MSVC-built) Windows Node.js uses the default binary; only a MinGW
|
|
50
|
-
// runtime (or an explicit npm_config_libc=mingw when cross-compiling) needs the
|
|
51
|
-
// jellyfin build. See useMingwToolchain() for the detection rationale.
|
|
52
|
-
if (sysPlatform === 'win32' && useMingwToolchain()) {
|
|
53
|
-
filename = filename.replace('.zip', '-jellyfin.zip');
|
|
54
|
-
}
|
|
55
|
-
console.log(`Detected platform: ${sysPlatform} / ${arch}`);
|
|
56
|
-
console.log(`Using binary: ${filename}`);
|
|
57
|
-
const ffmpegBinaryPath = resolve(__dirname, '../../binary');
|
|
58
|
-
const ffmpegFilePath = resolve(ffmpegBinaryPath, filename);
|
|
59
|
-
const ffmpegExtractedFilePath = ffmpegPath();
|
|
60
|
-
const versionMarkerPath = resolve(ffmpegBinaryPath, '.ffmpeg-version');
|
|
61
|
-
if (existsSync(ffmpegExtractedFilePath) && existsSync(versionMarkerPath)) {
|
|
62
|
-
try {
|
|
63
|
-
if (readFileSync(versionMarkerPath, 'utf8').trim() === filename) {
|
|
64
|
-
console.log(`FFmpeg ${ffmpegVersion} already installed, skipping download`);
|
|
65
|
-
process.exit(0);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
catch {
|
|
69
|
-
// Unreadable marker - fall through and re-download
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const isZipUrl = (url) => {
|
|
73
|
-
const pathArray = new URL(url).pathname.split('/');
|
|
74
|
-
const fileName = pathArray[pathArray.length - 1];
|
|
75
|
-
return fileName !== undefined && extname(fileName) === '.zip';
|
|
76
|
-
};
|
|
77
|
-
const sha256OfFile = async (path) => {
|
|
78
|
-
const hash = createHash('sha256');
|
|
79
|
-
await pipeline(createReadStream(path), hash);
|
|
80
|
-
return hash.digest('hex');
|
|
81
|
-
};
|
|
82
|
-
const fetchExpectedSha256 = async (url) => {
|
|
83
|
-
try {
|
|
84
|
-
const sumsUrl = new URL(url);
|
|
85
|
-
const parts = sumsUrl.pathname.split('/');
|
|
86
|
-
parts[parts.length - 1] = 'SHA256SUMS';
|
|
87
|
-
sumsUrl.pathname = parts.join('/');
|
|
88
|
-
const response = await fetch(sumsUrl);
|
|
89
|
-
if (!response.ok) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
const text = await response.text();
|
|
93
|
-
for (const line of text.split('\n')) {
|
|
94
|
-
// sha256sum format: "<hex> <filename>" (binary mode prefixes "*")
|
|
95
|
-
const match = /^([0-9a-fA-F]{64})\s+\*?(.+)$/.exec(line.trim());
|
|
96
|
-
if (!match) {
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
if (match[2] === filename) {
|
|
100
|
-
return match[1].toLowerCase();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
catch {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const downloadFile = async (url) => {
|
|
110
|
-
console.log(`Downloading FFmpeg ${ffmpegVersion} to ${ffmpegFilePath}...`);
|
|
111
|
-
const response = await fetch(url);
|
|
112
|
-
if (!response.ok) {
|
|
113
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
114
|
-
}
|
|
115
|
-
if (!response.body) {
|
|
116
|
-
throw new Error('Response body is null');
|
|
117
|
-
}
|
|
118
|
-
mkdirSync(ffmpegBinaryPath, { recursive: true });
|
|
119
|
-
// Progress tracking (optional, simpler without detailed progress)
|
|
120
|
-
const contentLength = response.headers.get('content-length');
|
|
121
|
-
let downloaded = 0;
|
|
122
|
-
const body = Readable.fromWeb(response.body);
|
|
123
|
-
if (!process.env.CI && contentLength) {
|
|
124
|
-
body.on('data', (chunk) => {
|
|
125
|
-
downloaded += chunk.length;
|
|
126
|
-
const percent = Math.round((downloaded / parseInt(contentLength)) * 100);
|
|
127
|
-
process.stdout.write(`\r${percent}%`);
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
try {
|
|
131
|
-
await pipeline(body, createWriteStream(ffmpegFilePath));
|
|
132
|
-
if (!process.env.CI && contentLength) {
|
|
133
|
-
process.stdout.write('\r');
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
catch (downloadError) {
|
|
137
|
-
try {
|
|
138
|
-
rmSync(ffmpegFilePath);
|
|
139
|
-
}
|
|
140
|
-
catch {
|
|
141
|
-
// Ignore cleanup errors
|
|
142
|
-
}
|
|
143
|
-
throw downloadError;
|
|
144
|
-
}
|
|
145
|
-
const expectedSha256 = await fetchExpectedSha256(url);
|
|
146
|
-
if (expectedSha256) {
|
|
147
|
-
const actualSha256 = await sha256OfFile(ffmpegFilePath);
|
|
148
|
-
if (actualSha256 !== expectedSha256) {
|
|
149
|
-
console.warn(`Warning: SHA256 mismatch for ${filename} (expected ${expectedSha256}, got ${actualSha256}); aborting extraction.`);
|
|
150
|
-
try {
|
|
151
|
-
rmSync(ffmpegFilePath);
|
|
152
|
-
}
|
|
153
|
-
catch {
|
|
154
|
-
// Ignore cleanup errors
|
|
155
|
-
}
|
|
156
|
-
throw new Error(`SHA256 checksum mismatch for ${filename}`);
|
|
157
|
-
}
|
|
158
|
-
console.log('SHA256 checksum verified');
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
console.log('No SHA256SUMS found for this release, skipping checksum verification');
|
|
162
|
-
}
|
|
163
|
-
if (isZipUrl(url)) {
|
|
164
|
-
console.log(`Extracting ${ffmpegFilePath} to ${ffmpegExtractedFilePath}...`);
|
|
165
|
-
try {
|
|
166
|
-
const directory = await Open.file(ffmpegFilePath);
|
|
167
|
-
if (directory.files?.length === 0) {
|
|
168
|
-
throw new Error('No files found in ZIP archive');
|
|
169
|
-
}
|
|
170
|
-
await new Promise((resolve, reject) => {
|
|
171
|
-
directory.files[0].stream().pipe(createWriteStream(ffmpegExtractedFilePath)).on('error', reject).on('finish', resolve);
|
|
172
|
-
});
|
|
173
|
-
console.log(`Removing ${ffmpegFilePath}...`);
|
|
174
|
-
rmSync(ffmpegFilePath);
|
|
175
|
-
}
|
|
176
|
-
catch (extractError) {
|
|
177
|
-
// Clean up on extraction failure
|
|
178
|
-
try {
|
|
179
|
-
rmSync(ffmpegFilePath);
|
|
180
|
-
}
|
|
181
|
-
catch {
|
|
182
|
-
// Ignore cleanup errors
|
|
183
|
-
}
|
|
184
|
-
throw new Error(`Failed to extract ZIP: ${extractError}`);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
console.log(`Renaming ${ffmpegFilePath} to ${ffmpegExtractedFilePath}...`);
|
|
189
|
-
await rename(ffmpegFilePath, ffmpegExtractedFilePath);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
const downloadFileWithRetries = async (url) => {
|
|
193
|
-
for (let attempt = 0;; attempt++) {
|
|
194
|
-
try {
|
|
195
|
-
await downloadFile(url);
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
if (attempt >= DOWNLOAD_RETRIES) {
|
|
200
|
-
throw error;
|
|
201
|
-
}
|
|
202
|
-
const delayMs = 1000 * (attempt + 1);
|
|
203
|
-
console.warn(`Download failed (${error instanceof Error ? error.message : error}); retrying in ${delayMs}ms (${attempt + 1}/${DOWNLOAD_RETRIES})...`);
|
|
204
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
const getReleaseAssets = async (version) => {
|
|
209
|
-
const url = `${releasesUrl}/tags/v${version}`;
|
|
210
|
-
console.log(`Fetching release info from ${url}...`);
|
|
211
|
-
const response = await fetch(url);
|
|
212
|
-
if (!response.ok) {
|
|
213
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
214
|
-
}
|
|
215
|
-
const data = await response.json();
|
|
216
|
-
const assets = data.assets.map((asset) => asset.browser_download_url);
|
|
217
|
-
const files = assets.map((asset) => asset.split(`${version}/`)[1]);
|
|
218
|
-
return {
|
|
219
|
-
assets,
|
|
220
|
-
files,
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
const downloadFFmpeg = async () => {
|
|
224
|
-
const directUrl = `${releaseDownloadBase}/v${pJson.version}/${filename}`;
|
|
225
|
-
try {
|
|
226
|
-
await downloadFileWithRetries(directUrl);
|
|
227
|
-
}
|
|
228
|
-
catch (directError) {
|
|
229
|
-
console.warn(`Direct download failed (${directError instanceof Error ? directError.message : directError}); trying the release API...`);
|
|
230
|
-
const release = await getReleaseAssets(pJson.version);
|
|
231
|
-
const apiUrl = release.assets.find((r) => r.endsWith(filename));
|
|
232
|
-
if (!apiUrl) {
|
|
233
|
-
throw new Error(`No ffmpeg binary found for architecture (${sysPlatform} / ${arch})`);
|
|
234
|
-
}
|
|
235
|
-
await downloadFileWithRetries(apiUrl);
|
|
236
|
-
}
|
|
237
|
-
if (sysPlatform === 'linux' || sysPlatform === 'darwin') {
|
|
238
|
-
console.log(`Making ${ffmpegExtractedFilePath} executable...`);
|
|
239
|
-
chmodSync(ffmpegExtractedFilePath, 0o755);
|
|
240
|
-
}
|
|
241
|
-
writeFileSync(versionMarkerPath, `${filename}\n`);
|
|
242
|
-
console.log('Done!');
|
|
243
|
-
};
|
|
244
|
-
downloadFFmpeg()
|
|
245
|
-
.catch((error) => {
|
|
246
|
-
console.warn('Warning: Failed to download FFmpeg binary:', error?.message ?? error);
|
|
247
|
-
console.warn('FFmpeg binary will not be available, but the package installation will continue.');
|
|
248
|
-
})
|
|
249
|
-
.finally(() => {
|
|
250
|
-
// Always exit successfully to avoid breaking npm install
|
|
251
|
-
process.exit(0);
|
|
252
|
-
});
|
|
253
|
-
//# sourceMappingURL=install.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/ffmpeg/install.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aA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If the environment variable `npm_config_os` is set, its value will be used
|
|
6
|
-
* instead. This is useful for cross-compilation scenarios.
|
|
7
|
-
*
|
|
8
|
-
* @returns The current platform
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare function getPlatform(): NodeJS.Platform;
|
|
13
|
-
/**
|
|
14
|
-
* Get the current platform type.
|
|
15
|
-
*
|
|
16
|
-
* @returns The current platform type
|
|
17
|
-
*
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export declare function getPlatformType(): string;
|
|
21
|
-
/**
|
|
22
|
-
* Determine whether the MinGW (jellyfin) Windows build should be used.
|
|
23
|
-
*
|
|
24
|
-
* On a native install this reflects the running Node.js: the official Windows
|
|
25
|
-
* Node.js is MSVC-built and reports `Windows_NT`, while a Node.js compiled under
|
|
26
|
-
* MSYS2/MinGW reports e.g. `MINGW64_NT-*` and needs the MinGW build.
|
|
27
|
-
*
|
|
28
|
-
* When cross-compiling (`npm_config_os` is set) the host's `os.type()` is
|
|
29
|
-
* meaningless for the target, so this defaults to the standard MSVC build and
|
|
30
|
-
* only opts into MinGW when `npm_config_libc=mingw` is explicitly passed.
|
|
31
|
-
*
|
|
32
|
-
* @returns True if the MinGW (jellyfin) build should be used
|
|
33
|
-
*
|
|
34
|
-
* @internal
|
|
35
|
-
*/
|
|
36
|
-
export declare function useMingwToolchain(): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Get the current architecture.
|
|
39
|
-
*
|
|
40
|
-
* If the environment variable `npm_config_cpu` is set, its value will be used
|
|
41
|
-
* instead. This is useful for cross-compilation scenarios.
|
|
42
|
-
*
|
|
43
|
-
* @returns The current architecture
|
|
44
|
-
*
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
export declare function getArchitecture(): ARCH;
|
package/dist/ffmpeg/utils.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
import { arch, platform, type } from 'node:os';
|
|
3
|
-
/**
|
|
4
|
-
* Get the current platform.
|
|
5
|
-
*
|
|
6
|
-
* If the environment variable `npm_config_os` is set, its value will be used
|
|
7
|
-
* instead. This is useful for cross-compilation scenarios.
|
|
8
|
-
*
|
|
9
|
-
* @returns The current platform
|
|
10
|
-
*
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export function getPlatform() {
|
|
14
|
-
if (process.env.npm_config_os) {
|
|
15
|
-
if (!process.env.npm_config_cpu) {
|
|
16
|
-
throw new Error('npm_config_cpu is required when npm_config_os is set');
|
|
17
|
-
}
|
|
18
|
-
return process.env.npm_config_os;
|
|
19
|
-
}
|
|
20
|
-
return platform();
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Get the current platform type.
|
|
24
|
-
*
|
|
25
|
-
* @returns The current platform type
|
|
26
|
-
*
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
export function getPlatformType() {
|
|
30
|
-
return type();
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Determine whether the MinGW (jellyfin) Windows build should be used.
|
|
34
|
-
*
|
|
35
|
-
* On a native install this reflects the running Node.js: the official Windows
|
|
36
|
-
* Node.js is MSVC-built and reports `Windows_NT`, while a Node.js compiled under
|
|
37
|
-
* MSYS2/MinGW reports e.g. `MINGW64_NT-*` and needs the MinGW build.
|
|
38
|
-
*
|
|
39
|
-
* When cross-compiling (`npm_config_os` is set) the host's `os.type()` is
|
|
40
|
-
* meaningless for the target, so this defaults to the standard MSVC build and
|
|
41
|
-
* only opts into MinGW when `npm_config_libc=mingw` is explicitly passed.
|
|
42
|
-
*
|
|
43
|
-
* @returns True if the MinGW (jellyfin) build should be used
|
|
44
|
-
*
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
export function useMingwToolchain() {
|
|
48
|
-
// MinGW builds are discontinued, so no install picks the jellyfin zip anymore
|
|
49
|
-
// if (process.env.npm_config_os) {
|
|
50
|
-
// return process.env.npm_config_libc === 'mingw';
|
|
51
|
-
// }
|
|
52
|
-
//
|
|
53
|
-
// return getPlatformType() !== 'Windows_NT';
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Get the current architecture.
|
|
58
|
-
*
|
|
59
|
-
* If the environment variable `npm_config_cpu` is set, its value will be used
|
|
60
|
-
* instead. This is useful for cross-compilation scenarios.
|
|
61
|
-
*
|
|
62
|
-
* @returns The current architecture
|
|
63
|
-
*
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
|
-
export function getArchitecture() {
|
|
67
|
-
if (process.env.npm_config_cpu) {
|
|
68
|
-
if (!process.env.npm_config_os) {
|
|
69
|
-
throw new Error('npm_config_os is required when npm_config_cpu is set');
|
|
70
|
-
}
|
|
71
|
-
return process.env.npm_config_cpu;
|
|
72
|
-
}
|
|
73
|
-
const sysPlatform = getPlatform();
|
|
74
|
-
let sysArch = arch();
|
|
75
|
-
if (sysPlatform === 'linux') {
|
|
76
|
-
try {
|
|
77
|
-
const output = execSync('cat /proc/cpuinfo | grep "model name"', { encoding: 'utf8' });
|
|
78
|
-
const modelName = output.trim().split(':')[1].trim();
|
|
79
|
-
if (modelName.includes('ARMv6')) {
|
|
80
|
-
sysArch = 'arm6';
|
|
81
|
-
}
|
|
82
|
-
else if (modelName.includes('ARMv7')) {
|
|
83
|
-
sysArch = 'arm7';
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
//
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return sysArch;
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/ffmpeg/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/ffmpeg/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IA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