ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

38 lines
920 B

  1. import { root } from '@peertube/peertube-node-utils'
  2. import { readdir, stat } from 'fs/promises'
  3. import { join } from 'path'
  4. async function run () {
  5. const result = {
  6. app: await buildResult(join(root(), 'client', 'dist', 'en-US')),
  7. embed: await buildResult(join(root(), 'client', 'dist', 'standalone', 'videos'))
  8. }
  9. console.log(JSON.stringify(result))
  10. }
  11. run()
  12. .catch(err => console.error(err))
  13. async function buildResult (path: string, root = path) {
  14. const distFiles = await readdir(path)
  15. let files: { name: string, size: number }[] = []
  16. for (const file of distFiles) {
  17. const filePath = join(path, file)
  18. const statsResult = await stat(filePath)
  19. if (statsResult.isDirectory()) {
  20. files = files.concat(await buildResult(filePath, root))
  21. }
  22. files.push({
  23. name: filePath.replace(new RegExp(`^${root}/`), ''),
  24. size: statsResult.size
  25. })
  26. }
  27. return files
  28. }