aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands/server/servers-command.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-19 16:02:49 +0200
committerChocobozzz <me@florianbigard.com>2023-07-21 17:38:13 +0200
commit12dc3a942a13c7f1489822dae052da197ef15905 (patch)
tree7b87b6be692af0b62ebac17e720c80244fd8a7ec /shared/server-commands/server/servers-command.ts
parentc6867725fb8e3dfbc2018a37ed5a963103587cb6 (diff)
downloadPeerTube-12dc3a942a13c7f1489822dae052da197ef15905.tar.gz
PeerTube-12dc3a942a13c7f1489822dae052da197ef15905.tar.zst
PeerTube-12dc3a942a13c7f1489822dae052da197ef15905.zip
Implement replace file in server side
Diffstat (limited to 'shared/server-commands/server/servers-command.ts')
-rw-r--r--shared/server-commands/server/servers-command.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/shared/server-commands/server/servers-command.ts b/shared/server-commands/server/servers-command.ts
index c91c2b008..54e586a18 100644
--- a/shared/server-commands/server/servers-command.ts
+++ b/shared/server-commands/server/servers-command.ts
@@ -1,5 +1,5 @@
1import { exec } from 'child_process' 1import { exec } from 'child_process'
2import { copy, ensureDir, readFile, remove } from 'fs-extra' 2import { copy, ensureDir, readFile, readdir, remove } from 'fs-extra'
3import { basename, join } from 'path' 3import { basename, join } from 'path'
4import { isGithubCI, root, wait } from '@shared/core-utils' 4import { isGithubCI, root, wait } from '@shared/core-utils'
5import { getFileSize } from '@shared/extra-utils' 5import { getFileSize } from '@shared/extra-utils'
@@ -77,6 +77,12 @@ export class ServersCommand extends AbstractCommand {
77 return join(root(), 'test' + this.server.internalServerNumber, directory) 77 return join(root(), 'test' + this.server.internalServerNumber, directory)
78 } 78 }
79 79
80 async countFiles (directory: string) {
81 const files = await readdir(this.buildDirectory(directory))
82
83 return files.length
84 }
85
80 buildWebVideoFilePath (fileUrl: string) { 86 buildWebVideoFilePath (fileUrl: string) {
81 return this.buildDirectory(join('web-videos', basename(fileUrl))) 87 return this.buildDirectory(join('web-videos', basename(fileUrl)))
82 } 88 }