chzzk-load 0.0.1

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 ADDED
@@ -0,0 +1,74 @@
1
+ # chzzk-load
2
+
3
+ High-performance standalone TUI application for monitoring, recording, and uploading Naver Chzzk livestreams directly to Google Drive in real-time.
4
+
5
+ Written in Rust for near-zero CPU and memory overhead, using FFmpeg stream-copy (`-c copy`) and chunked resumable Google Drive uploads.
6
+
7
+ ---
8
+
9
+ ## Quick Start
10
+
11
+ ### Run immediately with `npx`
12
+ ```bash
13
+ npx chzzk-load
14
+ ```
15
+
16
+ ### Install globally
17
+ ```bash
18
+ npm install -g chzzk-load
19
+ chzzk-load
20
+ ```
21
+
22
+ ---
23
+
24
+ ## Prerequisites
25
+
26
+ - **FFmpeg**: Must be installed and available on your system `PATH`.
27
+ - **Windows**: `winget install Gyan.FFmpeg` or `choco install ffmpeg`
28
+ - **macOS**: `brew install ffmpeg`
29
+ - **Ubuntu / Debian**: `sudo apt install ffmpeg`
30
+ - Verify with: `ffmpeg -version`
31
+ - **Node.js**: Version 16.0.0 or later (for this npm runner).
32
+
33
+ ---
34
+
35
+ ## Supported Platforms
36
+
37
+ `chzzk-load` automatically detects your operating system and CPU architecture, downloading the corresponding native pre-compiled binary via optional dependencies:
38
+
39
+ | Platform | Architecture | Package |
40
+ | :--- | :--- | :--- |
41
+ | **Windows** | x86_64 | `chzzk-load-windows-x64` |
42
+ | **Linux** | x86_64 | `chzzk-load-linux-x64` |
43
+ | **Linux** | ARM64 | `chzzk-load-linux-arm64` |
44
+ | **macOS** | x86_64 (Intel) | `chzzk-load-darwin-x64` |
45
+ | **macOS** | ARM64 (Apple Silicon) | `chzzk-load-darwin-arm64` |
46
+
47
+ ---
48
+
49
+ ## Environment Variables
50
+
51
+ - `CHZZK_LOAD_BIN`: Path to a custom `chzzk-load` executable. If set, the runner executes this binary directly instead of looking for platform-specific packages.
52
+ ```bash
53
+ # Linux / macOS
54
+ export CHZZK_LOAD_BIN="/usr/local/bin/chzzk-load"
55
+
56
+ # Windows (PowerShell)
57
+ $env:CHZZK_LOAD_BIN = "C:\Tools\chzzk-load.exe"
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Manual Binary Download
63
+
64
+ If optional dependencies cannot be installed in your environment (e.g., `--no-optional` was passed), standalone executables are available on the [GitHub Releases](https://github.com/ghfhffh12345/chzzk-load/releases) page.
65
+
66
+ ---
67
+
68
+ ## Documentation & Repository
69
+
70
+ For configuration details, TUI keyboard shortcuts, and architecture documentation, visit the [GitHub Repository](https://github.com/ghfhffh12345/chzzk-load).
71
+
72
+ ## License
73
+
74
+ [Apache-2.0](https://github.com/ghfhffh12345/chzzk-load/blob/main/LICENSE)
@@ -0,0 +1,150 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const PLATFORMS = {
8
+ 'win32-x64': {
9
+ pkgName: 'chzzk-load-windows-x64',
10
+ altPkgName: 'chzzk-load-win32-x64',
11
+ binName: 'chzzk-load.exe',
12
+ },
13
+ 'linux-x64': {
14
+ pkgName: 'chzzk-load-linux-x64',
15
+ binName: 'chzzk-load',
16
+ },
17
+ 'linux-arm64': {
18
+ pkgName: 'chzzk-load-linux-arm64',
19
+ binName: 'chzzk-load',
20
+ },
21
+ 'darwin-x64': {
22
+ pkgName: 'chzzk-load-darwin-x64',
23
+ binName: 'chzzk-load',
24
+ },
25
+ 'darwin-arm64': {
26
+ pkgName: 'chzzk-load-darwin-arm64',
27
+ binName: 'chzzk-load',
28
+ },
29
+ };
30
+
31
+ function getPlatformSpec() {
32
+ const key = `${process.platform}-${process.arch}`;
33
+ return PLATFORMS[key] || null;
34
+ }
35
+
36
+ function findBinary() {
37
+ // 1. Environment variable override
38
+ if (process.env.CHZZK_LOAD_BIN) {
39
+ const customPath = process.env.CHZZK_LOAD_BIN;
40
+ if (fs.existsSync(customPath)) {
41
+ return customPath;
42
+ }
43
+ console.error(`[chzzk-load] Warning: CHZZK_LOAD_BIN is set to "${customPath}" but file does not exist.`);
44
+ }
45
+
46
+ const spec = getPlatformSpec();
47
+ if (!spec) {
48
+ return null;
49
+ }
50
+
51
+ const { binName } = spec;
52
+ const pkgNames = [spec.pkgName];
53
+ if (spec.altPkgName) pkgNames.push(spec.altPkgName);
54
+
55
+ for (const name of pkgNames) {
56
+ // 2. Try require.resolve
57
+ try {
58
+ const resolvedPath = require.resolve(`${name}/bin/${binName}`);
59
+ if (fs.existsSync(resolvedPath)) {
60
+ return resolvedPath;
61
+ }
62
+ } catch (_) {
63
+ // Package not found via require.resolve
64
+ }
65
+
66
+ // 3. Search in relative node_modules locations
67
+ const candidates = [
68
+ path.join(__dirname, '..', '..', name, 'bin', binName),
69
+ path.join(__dirname, '..', '..', 'node_modules', name, 'bin', binName),
70
+ path.join(__dirname, '..', 'node_modules', name, 'bin', binName),
71
+ ];
72
+
73
+ for (const candidate of candidates) {
74
+ if (fs.existsSync(candidate)) {
75
+ return candidate;
76
+ }
77
+ }
78
+ }
79
+
80
+ return null;
81
+ }
82
+
83
+ function printTroubleshooting(spec) {
84
+ const current = `${process.platform}-${process.arch}`;
85
+ console.error('\n[chzzk-load] Error: Could not find native binary for your platform (' + current + ').');
86
+ console.error('[chzzk-load] 오류: 현재 플랫폼(' + current + ')에 해당하는 바이너리를 찾을 수 없습니다.\n');
87
+
88
+ if (!spec) {
89
+ console.error('Supported platforms / 지원 플랫폼:');
90
+ console.error(' - Windows x64 (win32-x64)');
91
+ console.error(' - Linux x64 (linux-x64)');
92
+ console.error(' - Linux ARM64 (linux-arm64)');
93
+ console.error(' - macOS x64 (darwin-x64)');
94
+ console.error(' - macOS Apple Silicon (darwin-arm64)\n');
95
+ } else {
96
+ console.error('Expected package: ' + spec.pkgName);
97
+ console.error('This typically occurs if optional dependencies were skipped (e.g., using --no-optional).\n');
98
+ }
99
+
100
+ console.error('Troubleshooting options / 해결 방법:');
101
+ console.error(' 1. Reinstall with optional dependencies enabled:');
102
+ console.error(' npm install -g chzzk-load');
103
+ console.error(' 2. Or download the standalone binary directly from GitHub Releases:');
104
+ console.error(' https://github.com/ghfhffh12345/chzzk-load/releases');
105
+ console.error(' 3. Or set CHZZK_LOAD_BIN to point to a local chzzk-load binary:');
106
+ console.error(' export CHZZK_LOAD_BIN=/path/to/chzzk-load (Linux/macOS)');
107
+ console.error(' $env:CHZZK_LOAD_BIN="C:\\path\\to\\chzzk-load.exe" (PowerShell)\n');
108
+ }
109
+
110
+ function main() {
111
+ const spec = getPlatformSpec();
112
+ const binPath = findBinary();
113
+
114
+ if (!binPath) {
115
+ printTroubleshooting(spec);
116
+ process.exit(1);
117
+ }
118
+
119
+ if (process.platform !== 'win32') {
120
+ try {
121
+ fs.chmodSync(binPath, 0o755);
122
+ } catch (_) {
123
+ // Ignore chmod errors if file is not writable or already executable
124
+ }
125
+ }
126
+
127
+ const child = spawn(binPath, process.argv.slice(2), {
128
+ stdio: 'inherit',
129
+ });
130
+
131
+ process.on('SIGINT', () => child.kill('SIGINT'));
132
+ process.on('SIGTERM', () => child.kill('SIGTERM'));
133
+ process.on('SIGHUP', () => child.kill('SIGHUP'));
134
+
135
+ child.on('error', (err) => {
136
+ console.error('[chzzk-load] Failed to start native process:', err);
137
+ process.exit(1);
138
+ });
139
+
140
+ child.on('exit', (code, signal) => {
141
+ if (code !== null) {
142
+ process.exit(code);
143
+ }
144
+ if (signal) {
145
+ process.kill(process.pid, signal);
146
+ }
147
+ });
148
+ }
149
+
150
+ main();
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "chzzk-load",
3
+ "version": "0.0.1",
4
+ "description": "High-performance TUI for recording Naver Chzzk streams and streaming to Google Drive",
5
+ "bin": {
6
+ "chzzk-load": "./bin/chzzk-load.js"
7
+ },
8
+ "keywords": [
9
+ "chzzk",
10
+ "naver",
11
+ "recorder",
12
+ "livestream",
13
+ "tui",
14
+ "google-drive",
15
+ "cli"
16
+ ],
17
+ "author": "ghfhffh12345",
18
+ "license": "Apache-2.0",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/ghfhffh12345/chzzk-load.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/ghfhffh12345/chzzk-load/issues"
25
+ },
26
+ "homepage": "https://github.com/ghfhffh12345/chzzk-load#readme",
27
+ "engines": {
28
+ "node": ">=16.0.0"
29
+ },
30
+ "optionalDependencies": {
31
+ "chzzk-load-windows-x64": "0.0.1",
32
+ "chzzk-load-linux-x64": "0.0.1",
33
+ "chzzk-load-linux-arm64": "0.0.1",
34
+ "chzzk-load-darwin-x64": "0.0.1",
35
+ "chzzk-load-darwin-arm64": "0.0.1"
36
+ }
37
+ }