diff options
Diffstat (limited to 'server/helpers/core-utils.ts')
-rw-r--r-- | server/helpers/core-utils.ts | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts index 9830d41a8..f5ef187fe 100644 --- a/server/helpers/core-utils.ts +++ b/server/helpers/core-utils.ts | |||
@@ -6,7 +6,6 @@ | |||
6 | import * as bcrypt from 'bcrypt' | 6 | import * as bcrypt from 'bcrypt' |
7 | import * as createTorrent from 'create-torrent' | 7 | import * as createTorrent from 'create-torrent' |
8 | import { createHash, pseudoRandomBytes } from 'crypto' | 8 | import { createHash, pseudoRandomBytes } from 'crypto' |
9 | import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile, mkdirp } from 'fs-extra' | ||
10 | import { isAbsolute, join } from 'path' | 9 | import { isAbsolute, join } from 'path' |
11 | import * as pem from 'pem' | 10 | import * as pem from 'pem' |
12 | import * as rimraf from 'rimraf' | 11 | import * as rimraf from 'rimraf' |
@@ -168,14 +167,6 @@ function promisify2WithVoid<T, U> (func: (arg1: T, arg2: U, cb: (err: any) => vo | |||
168 | } | 167 | } |
169 | } | 168 | } |
170 | 169 | ||
171 | const copyFilePromise = promisify2WithVoid<string, string>(copyFile) | ||
172 | const readFileBufferPromise = promisify1<string, Buffer>(readFile) | ||
173 | const unlinkPromise = promisify1WithVoid<string>(unlink) | ||
174 | const renamePromise = promisify2WithVoid<string, string>(rename) | ||
175 | const writeFilePromise = promisify2WithVoid<string, any>(writeFile) | ||
176 | const readdirPromise = promisify1<string, string[]>(readdir) | ||
177 | const mkdirpPromise = promisify1<string, string>(mkdirp) | ||
178 | // we cannot modify the Promise types, so we should make the promisify instance check mkdirp | ||
179 | const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes) | 170 | const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes) |
180 | const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey) | 171 | const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey) |
181 | const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey) | 172 | const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey) |
@@ -183,8 +174,6 @@ const bcryptComparePromise = promisify2<any, string, boolean>(bcrypt.compare) | |||
183 | const bcryptGenSaltPromise = promisify1<number, string>(bcrypt.genSalt) | 174 | const bcryptGenSaltPromise = promisify1<number, string>(bcrypt.genSalt) |
184 | const bcryptHashPromise = promisify2<any, string | number, string>(bcrypt.hash) | 175 | const bcryptHashPromise = promisify2<any, string | number, string>(bcrypt.hash) |
185 | const createTorrentPromise = promisify2<string, any, any>(createTorrent) | 176 | const createTorrentPromise = promisify2<string, any, any>(createTorrent) |
186 | const rimrafPromise = promisify1WithVoid<string>(rimraf) | ||
187 | const statPromise = promisify1<string, Stats>(stat) | ||
188 | 177 | ||
189 | // --------------------------------------------------------------------------- | 178 | // --------------------------------------------------------------------------- |
190 | 179 | ||
@@ -202,20 +191,11 @@ export { | |||
202 | promisify0, | 191 | promisify0, |
203 | promisify1, | 192 | promisify1, |
204 | 193 | ||
205 | copyFilePromise, | ||
206 | readdirPromise, | ||
207 | readFileBufferPromise, | ||
208 | unlinkPromise, | ||
209 | renamePromise, | ||
210 | writeFilePromise, | ||
211 | mkdirpPromise, | ||
212 | pseudoRandomBytesPromise, | 194 | pseudoRandomBytesPromise, |
213 | createPrivateKey, | 195 | createPrivateKey, |
214 | getPublicKey, | 196 | getPublicKey, |
215 | bcryptComparePromise, | 197 | bcryptComparePromise, |
216 | bcryptGenSaltPromise, | 198 | bcryptGenSaltPromise, |
217 | bcryptHashPromise, | 199 | bcryptHashPromise, |
218 | createTorrentPromise, | 200 | createTorrentPromise |
219 | rimrafPromise, | ||
220 | statPromise | ||
221 | } | 201 | } |