Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit 9f32da5

Browse files
committed
0.7
1 parent ee13c56 commit 9f32da5

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ app.get('/:user/:repo/', async function (req, res) {
4848
res.send('permission denied');
4949
return;
5050
}
51-
const repo_info = await cache.requestWithCache(`/repos/${username}/${repo}`);
52-
res.send(await getLanguage(username, repo));
51+
const resp = await cache.requestWithCache(`/repos/${username}/${repo}`);
52+
53+
res.send({
54+
size: utils.storeConvert(resp['size'], 1),
55+
langs: await getLanguage(username, repo),
56+
});
5357
})
5458

5559

utils.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
const units = ["b", "KiB", "MiB", "GiB", "TiB", "PiB"]
22
const len_units = units.length - 1;
33

4-
function storeConvert(size) {
4+
function storeConvert(size, idx=0) {
55
if (size <= 0) {
66
return "0";
77
}
88

9-
let idx = 0;
109
while (idx < len_units && size > 1024) {
11-
console.log(idx, size)
1210
size /= 1024;
1311
idx ++;
1412
}

0 commit comments

Comments
 (0)