trzsz2 1.2.0 → 1.3.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.
@@ -5460,6 +5460,9 @@ var Trzsz2 = (function(exports) {
5460
5460
  if (tmuxPaneWidth > 0) {
5461
5461
  config.tmux_pane_width = tmuxPaneWidth;
5462
5462
  }
5463
+ if (args.mtime === true) {
5464
+ config.mtime = true;
5465
+ }
5463
5466
  let jsonStr = JSON.stringify(config);
5464
5467
  jsonStr = jsonStr.replace(/[\u007F-\uFFFF]/g, function(chr) {
5465
5468
  return "\\u" + ("0000" + chr.charCodeAt(0).toString(16)).slice(-4);
@@ -5660,6 +5663,17 @@ var Trzsz2 = (function(exports) {
5660
5663
  progressCallback.onDone();
5661
5664
  }
5662
5665
  }
5666
+ /**
5667
+ * Send file mtime.
5668
+ * @param mtime - The modification time in milliseconds.
5669
+ */
5670
+ async sendFileMtime(mtime) {
5671
+ if (this.transferConfig.mtime !== true) {
5672
+ return;
5673
+ }
5674
+ await this.sendInteger("MTIME", mtime);
5675
+ await this.checkInteger(mtime);
5676
+ }
5663
5677
  /**
5664
5678
  * Send files.
5665
5679
  * @param files - The file readers.
@@ -5687,6 +5701,7 @@ var Trzsz2 = (function(exports) {
5687
5701
  const digest = await this.sendFileData(file, size, binary, escapeCodes, maxBufSize, progressCallback);
5688
5702
  file.closeFile();
5689
5703
  await this.sendFileMD5(digest, progressCallback);
5704
+ await this.sendFileMtime(file.getMtime());
5690
5705
  }
5691
5706
  return remoteNames;
5692
5707
  }
@@ -5784,6 +5799,18 @@ var Trzsz2 = (function(exports) {
5784
5799
  progressCallback.onDone();
5785
5800
  }
5786
5801
  }
5802
+ /**
5803
+ * Receive file mtime.
5804
+ * @return The modification time in milliseconds, or 0 if not available.
5805
+ */
5806
+ async recvFileMtime() {
5807
+ if (this.transferConfig.mtime !== true) {
5808
+ return 0;
5809
+ }
5810
+ const mtime = await this.recvInteger("MTIME");
5811
+ await this.sendInteger("SUCC", mtime);
5812
+ return mtime;
5813
+ }
5787
5814
  /**
5788
5815
  * Receive files.
5789
5816
  * @param saveParam - The save parameter.
@@ -5825,6 +5852,10 @@ var Trzsz2 = (function(exports) {
5825
5852
  );
5826
5853
  file.closeFile();
5827
5854
  await this.recvFileMD5(digest, progressCallback);
5855
+ const mtime = await this.recvFileMtime();
5856
+ if (mtime > 0) {
5857
+ file.setMtime(mtime);
5858
+ }
5828
5859
  }
5829
5860
  return localNames;
5830
5861
  }