Skip to content

Commit

Permalink
module directory size print
Browse files Browse the repository at this point in the history
changes:
- added print of module directory size next to Download
- discarded left align in Download column
  • Loading branch information
Andros-Spica committed Sep 19, 2022
1 parent 0365e61 commit 07dd82e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions website_generator/package_page_template.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ cat(paste(authors, collapse = "<br>"))

#### Module files

```{r}
dir_size <- function(path, recursive = TRUE) {
stopifnot(is.character(path))
files <- list.files(path, full.names = T, recursive = recursive)
vect_size <- sapply(files, function(x) file.size(x))
size_files <- sum(vect_size)
return(round(size_files/10**6, digits = 2)) # in MB, rounded to two decimal digits
}
moduleSize <- paste(dir_size(module_path), "MB")
```

```{r}
github_link <- htmltools::tags$a(
fontawesome::fa("github", fill = "#03989E", height = '100px'),
Expand All @@ -97,15 +109,15 @@ download_link <- htmltools::tags$a(
<td>
Go to repository
</td>
<td style="text-align: left;">
Download
<td>
Download (`r moduleSize`)
</td>
</tr>
<tr id="structGrid">
<td>
`r github_link`
</td>
<td style="text-align: left;">
<td>
`r download_link`
</td>
</tr>
Expand Down

0 comments on commit 07dd82e

Please sign in to comment.