@pproenca/ffmpeg-lgpl 0.1.7

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.
Files changed (3) hide show
  1. package/.gitkeep +0 -0
  2. package/install.js +62 -0
  3. package/package.json +23 -0
package/.gitkeep ADDED
File without changes
package/install.js ADDED
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Fallback installer for when optionalDependencies are disabled.
4
+ * Attempts to locate the platform-specific package or provides guidance.
5
+ */
6
+
7
+ const os = require('os');
8
+
9
+ const TIER_SUFFIX = '-lgpl';
10
+
11
+ const PLATFORMS = {
12
+ 'darwin-arm64': { os: 'darwin', cpu: 'arm64' },
13
+ 'darwin-x64': { os: 'darwin', cpu: 'x64' },
14
+ 'linux-x64': { os: 'linux', cpu: 'x64' },
15
+ 'linux-arm64': { os: 'linux', cpu: 'arm64' },
16
+ 'win32-x64': { os: 'win32', cpu: 'x64' },
17
+ 'win32-arm64': { os: 'win32', cpu: 'arm64' },
18
+ };
19
+
20
+ function getPlatformKey() {
21
+ const platform = os.platform();
22
+ const arch = os.arch();
23
+ return `${platform}-${arch}`;
24
+ }
25
+
26
+ function getPackageName(platformKey) {
27
+ return `@pproenca/ffmpeg-${platformKey}-lgpl`;
28
+ }
29
+
30
+ function checkInstalled(packageName) {
31
+ try {
32
+ require.resolve(packageName);
33
+ return true;
34
+ } catch {
35
+ return false;
36
+ }
37
+ }
38
+
39
+ function main() {
40
+ const platformKey = getPlatformKey();
41
+
42
+ if (!PLATFORMS[platformKey]) {
43
+ console.warn(`[ffmpeg] Warning: Unsupported platform: ${platformKey}`);
44
+ console.warn('[ffmpeg] Prebuilt binaries may not be available for your system.');
45
+ process.exit(0);
46
+ }
47
+
48
+ const packageName = getPackageName(platformKey);
49
+
50
+ if (checkInstalled(packageName)) {
51
+ // Package was installed via optionalDependencies - all good
52
+ process.exit(0);
53
+ }
54
+
55
+ // Package not found - provide guidance
56
+ console.warn(`[ffmpeg] Warning: Platform package not found: ${packageName}`);
57
+ console.warn('[ffmpeg] This usually happens when --no-optional or --ignore-optional is used.');
58
+ console.warn(`[ffmpeg] To install manually: npm install ${packageName}`);
59
+ process.exit(0);
60
+ }
61
+
62
+ main();
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@pproenca/ffmpeg-lgpl",
3
+ "version": "0.1.7",
4
+ "description": "Prebuilt FFmpeg with BSD + LGPL codecs (adds MP3) - auto-selects platform",
5
+ "author": "Pedro Proenca",
6
+ "homepage": "https://github.com/pproenca/ffmpeg-prebuilds",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/pproenca/ffmpeg-prebuilds.git",
10
+ "directory": "npm/ffmpeg-lgpl"
11
+ },
12
+ "license": "LGPL-2.1-or-later",
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "scripts": {
17
+ "postinstall": "node install.js"
18
+ },
19
+ "optionalDependencies": {
20
+ "@pproenca/ffmpeg-darwin-arm64-lgpl": "0.1.7",
21
+ "@pproenca/ffmpeg-darwin-x64-lgpl": "0.1.7"
22
+ }
23
+ }