diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-19 16:02:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-21 17:38:13 +0200 |
commit | 12dc3a942a13c7f1489822dae052da197ef15905 (patch) | |
tree | 7b87b6be692af0b62ebac17e720c80244fd8a7ec /shared/server-commands/server/servers-command.ts | |
parent | c6867725fb8e3dfbc2018a37ed5a963103587cb6 (diff) | |
download | PeerTube-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.ts | 8 |
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 @@ | |||
1 | import { exec } from 'child_process' | 1 | import { exec } from 'child_process' |
2 | import { copy, ensureDir, readFile, remove } from 'fs-extra' | 2 | import { copy, ensureDir, readFile, readdir, remove } from 'fs-extra' |
3 | import { basename, join } from 'path' | 3 | import { basename, join } from 'path' |
4 | import { isGithubCI, root, wait } from '@shared/core-utils' | 4 | import { isGithubCI, root, wait } from '@shared/core-utils' |
5 | import { getFileSize } from '@shared/extra-utils' | 5 | import { 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 | } |