提交 e9a53b79 编写于 作者: J Joao Moreno

build: publish asset size

上级 f918939d
......@@ -68,6 +68,7 @@ interface Asset {
mooncakeUrl: string;
hash: string;
sha256hash: string;
size: number;
}
function createOrUpdate(commit: string, quality: string, platform: string, type: string, release: NewDocument, asset: Asset, isUpdate: boolean): Promise<void> {
......@@ -165,6 +166,11 @@ async function publish(commit: string, quality: string, platform: string, type:
console.log('Is Released:', isReleased);
console.log('File:', file);
const stat = await new Promise<fs.Stats>((c, e) => fs.stat(file, (err, stat) => err ? e(err) : c(stat)));
const size = stat.size;
console.log('Size:', size);
const stream = fs.createReadStream(file);
const [sha1hash, sha256hash] = await Promise.all([hashStream('sha1', stream), hashStream('sha256', stream)]);
......@@ -224,7 +230,8 @@ async function publish(commit: string, quality: string, platform: string, type:
url: `${process.env['AZURE_CDN_URL']}/${quality}/${blobName}`,
mooncakeUrl: `${process.env['MOONCAKE_CDN_URL']}/${quality}/${blobName}`,
hash: sha1hash,
sha256hash
sha256hash,
size
};
const release = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册