diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-27 14:32:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-27 15:12:22 +0200 |
commit | 41fb13c330de629df2d23379209e79c7af0f2e9a (patch) | |
tree | 73bc5a90566406b3910f142beae2a879c1e4265d /scripts/prune-storage.ts | |
parent | 40e7ed0714f96c01e16de3ac971a4b28116294e1 (diff) | |
download | PeerTube-41fb13c330de629df2d23379209e79c7af0f2e9a.tar.gz PeerTube-41fb13c330de629df2d23379209e79c7af0f2e9a.tar.zst PeerTube-41fb13c330de629df2d23379209e79c7af0f2e9a.zip |
esModuleInterop to true
Diffstat (limited to 'scripts/prune-storage.ts')
-rwxr-xr-x | scripts/prune-storage.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts index 5b029d215..00141fec1 100755 --- a/scripts/prune-storage.ts +++ b/scripts/prune-storage.ts | |||
@@ -1,14 +1,14 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | 1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' |
2 | registerTSPaths() | 2 | registerTSPaths() |
3 | 3 | ||
4 | import * as prompt from 'prompt' | 4 | import { start, get } from 'prompt' |
5 | import { join, basename } from 'path' | 5 | import { join, basename } from 'path' |
6 | import { CONFIG } from '../server/initializers/config' | 6 | import { CONFIG } from '../server/initializers/config' |
7 | import { VideoModel } from '../server/models/video/video' | 7 | import { VideoModel } from '../server/models/video/video' |
8 | import { initDatabaseModels } from '../server/initializers/database' | 8 | import { initDatabaseModels } from '../server/initializers/database' |
9 | import { readdir, remove, stat } from 'fs-extra' | 9 | import { readdir, remove, stat } from 'fs-extra' |
10 | import { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy' | 10 | import { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy' |
11 | import * as Bluebird from 'bluebird' | 11 | import { map } from 'bluebird' |
12 | import { getUUIDFromFilename } from '../server/helpers/utils' | 12 | import { getUUIDFromFilename } from '../server/helpers/utils' |
13 | import { ThumbnailModel } from '../server/models/video/thumbnail' | 13 | import { ThumbnailModel } from '../server/models/video/thumbnail' |
14 | import { ActorImageModel } from '../server/models/actor/actor-image' | 14 | import { ActorImageModel } from '../server/models/actor/actor-image' |
@@ -78,7 +78,7 @@ async function pruneDirectory (directory: string, existFun: ExistFun) { | |||
78 | const files = await readdir(directory) | 78 | const files = await readdir(directory) |
79 | 79 | ||
80 | const toDelete: string[] = [] | 80 | const toDelete: string[] = [] |
81 | await Bluebird.map(files, async file => { | 81 | await map(files, async file => { |
82 | const filePath = join(directory, file) | 82 | const filePath = join(directory, file) |
83 | 83 | ||
84 | if (await existFun(filePath) !== true) { | 84 | if (await existFun(filePath) !== true) { |
@@ -141,7 +141,7 @@ async function doesRedundancyExist (filePath: string) { | |||
141 | 141 | ||
142 | async function askConfirmation () { | 142 | async function askConfirmation () { |
143 | return new Promise((res, rej) => { | 143 | return new Promise((res, rej) => { |
144 | prompt.start() | 144 | start() |
145 | const schema = { | 145 | const schema = { |
146 | properties: { | 146 | properties: { |
147 | confirm: { | 147 | confirm: { |
@@ -154,7 +154,7 @@ async function askConfirmation () { | |||
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | prompt.get(schema, function (err, result) { | 157 | get(schema, function (err, result) { |
158 | if (err) return rej(err) | 158 | if (err) return rej(err) |
159 | 159 | ||
160 | return res(result.confirm?.match(/y/) !== null) | 160 | return res(result.confirm?.match(/y/) !== null) |