tokwatchr 0.4.0 → 0.4.2

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/dist/index.mjs CHANGED
@@ -440,6 +440,15 @@ async function downloadWithFfmpeg(options) {
440
440
  firstDataTimer = null;
441
441
  }
442
442
  signal?.removeEventListener("abort", onAbort);
443
+ if (err.name === "AbortError") {
444
+ aborted = true;
445
+ resolve({
446
+ sizeBytes,
447
+ duration,
448
+ format: outputPath.endsWith(".mkv") ? "mkv" : "mp4"
449
+ });
450
+ return;
451
+ }
443
452
  reject(new FfmpegError(err.message));
444
453
  });
445
454
  proc.on("close", (code) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokwatchr",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Download TikTok livestreams. Given a username, download the livestream.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -40,6 +40,10 @@
40
40
  "stream"
41
41
  ],
42
42
  "license": "MIT",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/zfadhli/tokwatchr.git"
46
+ },
43
47
  "devDependencies": {
44
48
  "@biomejs/biome": "^2.4.16",
45
49
  "@types/bun": "latest",
@@ -201,6 +201,19 @@ export async function downloadWithFfmpeg(
201
201
  firstDataTimer = null;
202
202
  }
203
203
  signal?.removeEventListener("abort", onAbort);
204
+ // spawn's signal option emits AbortError when the signal
205
+ // is already aborted at spawn time or fires mid-flight.
206
+ // Don't reject — resolve with partial data instead, same
207
+ // as the close handler does for aborted downloads.
208
+ if (err.name === "AbortError") {
209
+ aborted = true;
210
+ resolve({
211
+ sizeBytes,
212
+ duration,
213
+ format: outputPath.endsWith(".mkv") ? "mkv" : "mp4",
214
+ });
215
+ return;
216
+ }
204
217
  reject(new FfmpegError(err.message));
205
218
  });
206
219