瀏覽代碼

Merge branch 'master' of https://github.com/gram-js/gramjs

Painor 8 月之前
父節點
當前提交
372ee41167
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 1 1
      gramjs/client/downloads.ts
  2. 2 2
      gramjs/define.d.ts

+ 1 - 1
gramjs/client/downloads.ts

@@ -430,13 +430,13 @@ export async function downloadFileV2(
             msgData: msgData,
         })) {
             await writer.write(chunk);
+            downloaded = downloaded.add(chunk.length);
             if (progressCallback) {
                 await progressCallback(
                     downloaded,
                     bigInt(fileSize || bigInt.zero)
                 );
             }
-            downloaded = downloaded.add(chunk.length);
         }
         return returnWriterValue(writer);
     } finally {

+ 2 - 2
gramjs/define.d.ts

@@ -64,8 +64,8 @@ type OutFile =
     | WriteStream
     | { write: Function; close?: Function };
 type ProgressCallback = (
-    total: bigInt.BigInteger,
-    downloaded: bigInt.BigInteger
+    downloaded: bigInt.BigInteger,
+    total: bigInt.BigInteger
 ) => void;
 type ButtonLike = Api.TypeKeyboardButton | Button;