tokwatchr 0.6.2 → 0.6.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/dist/index.d.mts CHANGED
@@ -101,6 +101,8 @@ interface RemuxInfo {
101
101
  filePath: string;
102
102
  /** Input file size in MB. */
103
103
  inputSizeMB: number;
104
+ /** Output file size in MB. Only set when status is "completed". */
105
+ outputSizeMB?: number;
104
106
  /** Remux status: started → completed (with outputPath) or failed (keeping .ts). */
105
107
  status: "started" | "completed" | "failed";
106
108
  /** Output file path. Only set when status is "completed". */
package/dist/index.mjs CHANGED
@@ -988,6 +988,11 @@ var TikTokLiveDownloader = class {
988
988
  });
989
989
  try {
990
990
  await this.remuxAndNormalize(this.options.ffmpegPath, inputPath, finalPath);
991
+ let realSizeBytes = tsResult.sizeBytes;
992
+ try {
993
+ const { statSync } = await import("node:fs");
994
+ realSizeBytes = statSync(finalPath).size;
995
+ } catch {}
991
996
  try {
992
997
  const { unlinkSync } = await import("node:fs");
993
998
  unlinkSync(inputPath);
@@ -996,11 +1001,14 @@ var TikTokLiveDownloader = class {
996
1001
  filePath: inputPath,
997
1002
  outputPath: finalPath,
998
1003
  inputSizeMB: tsResult.sizeMB,
1004
+ outputSizeMB: realSizeBytes / (1024 * 1024),
999
1005
  status: "completed"
1000
1006
  });
1001
1007
  return {
1002
1008
  ...tsResult,
1003
1009
  filePath: finalPath,
1010
+ sizeBytes: realSizeBytes,
1011
+ sizeMB: realSizeBytes / (1024 * 1024),
1004
1012
  format: finalExt
1005
1013
  };
1006
1014
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokwatchr",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Download TikTok livestreams. Given a username, download the livestream.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -584,7 +584,16 @@ export class TikTokLiveDownloader {
584
584
  inputPath,
585
585
  finalPath,
586
586
  );
587
- // Remux succeeded — delete temp .ts
587
+ // Remux succeeded — stat the real output size
588
+ let realSizeBytes = tsResult.sizeBytes;
589
+ try {
590
+ const { statSync } = await import("node:fs");
591
+ realSizeBytes = statSync(finalPath).size;
592
+ } catch {
593
+ // fall back to input size if stat fails
594
+ }
595
+
596
+ // Delete temp .ts
588
597
  try {
589
598
  const { unlinkSync } = await import("node:fs");
590
599
  unlinkSync(inputPath);
@@ -596,12 +605,15 @@ export class TikTokLiveDownloader {
596
605
  filePath: inputPath,
597
606
  outputPath: finalPath,
598
607
  inputSizeMB: tsResult.sizeMB,
608
+ outputSizeMB: realSizeBytes / (1024 * 1024),
599
609
  status: "completed",
600
610
  });
601
611
 
602
612
  return {
603
613
  ...tsResult,
604
614
  filePath: finalPath,
615
+ sizeBytes: realSizeBytes,
616
+ sizeMB: realSizeBytes / (1024 * 1024),
605
617
  format: finalExt as "mp4" | "mkv",
606
618
  };
607
619
  } catch (err) {
package/src/types.ts CHANGED
@@ -128,6 +128,8 @@ export interface RemuxInfo {
128
128
  filePath: string;
129
129
  /** Input file size in MB. */
130
130
  inputSizeMB: number;
131
+ /** Output file size in MB. Only set when status is "completed". */
132
+ outputSizeMB?: number;
131
133
  /** Remux status: started → completed (with outputPath) or failed (keeping .ts). */
132
134
  status: "started" | "completed" | "failed";
133
135
  /** Output file path. Only set when status is "completed". */