- 在editStorageForm中初始化oss_storage_quota_value和oss_quota_unit - 删除重复的旧配额说明块,保留新的当前配额设置显示 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
20 lines
713 B
JavaScript
20 lines
713 B
JavaScript
import { HashCalculator } from "./HashCalculator";
|
|
export const readableStreamHasher = (hashCtor, readableStream) => {
|
|
if (readableStream.readableFlowing !== null) {
|
|
throw new Error("Unable to calculate hash for flowing readable stream");
|
|
}
|
|
const hash = new hashCtor();
|
|
const hashCalculator = new HashCalculator(hash);
|
|
readableStream.pipe(hashCalculator);
|
|
return new Promise((resolve, reject) => {
|
|
readableStream.on("error", (err) => {
|
|
hashCalculator.end();
|
|
reject(err);
|
|
});
|
|
hashCalculator.on("error", reject);
|
|
hashCalculator.on("finish", () => {
|
|
hash.digest().then(resolve).catch(reject);
|
|
});
|
|
});
|
|
};
|