Release v2.1.65: safe MCP updates and measured upload scheduling
CI / verify (push) Canceled after 0s
CI / verify (push) Canceled after 0s
This commit is contained in:
1 parent
e3c03d195e
commit
1ff552fc40
26 files changed
+552
-92
No files matched your search
@@ -1,4 +1,4 @@
|
||||
const fs = require('fs');
|
||||
const { statUploadFile, readUploadFile } = require('./upload-file-io');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
const { request } = require('undici');
|
||||
@@ -179,7 +179,7 @@ class VidmolyUploader {
|
||||
*/
|
||||
async upload(filePath, onProgress, signal, throttle) {
|
||||
const fileName = path.basename(filePath);
|
||||
const fileSize = fs.statSync(filePath).size;
|
||||
const fileSize = (await statUploadFile(filePath)).size;
|
||||
const baselineCodes = await this._captureVmFileCodes();
|
||||
|
||||
const { uploadUrl, params, fileFieldName } = await this.getUploadParams();
|
||||
@@ -213,12 +213,10 @@ class VidmolyUploader {
|
||||
const totalSize = preambleBuf.length + fileSize + epilogueBuf.length;
|
||||
|
||||
let bytesRead = 0;
|
||||
const CHUNK_SIZE = 1024 * 1024;
|
||||
|
||||
async function* generate() {
|
||||
yield preambleBuf;
|
||||
const fileStream = fs.createReadStream(filePath, { highWaterMark: CHUNK_SIZE });
|
||||
for await (const chunk of fileStream) {
|
||||
for await (const chunk of readUploadFile(filePath, signal)) {
|
||||
if (signal && signal.aborted) throw new Error('Aborted');
|
||||
if (throttle) await throttle.consume(chunk.length, signal);
|
||||
bytesRead += chunk.length;
|
||||
|
||||
Reference in new issue
Block a user