diff options
Diffstat (limited to 'server/helpers/core-utils.ts')
-rw-r--r-- | server/helpers/core-utils.ts | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts index 4ff07848c..443115336 100644 --- a/server/helpers/core-utils.ts +++ b/server/helpers/core-utils.ts | |||
@@ -3,23 +3,14 @@ | |||
3 | Useful to avoid circular dependencies. | 3 | Useful to avoid circular dependencies. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | import { join } from 'path' | ||
7 | import { pseudoRandomBytes } from 'crypto' | ||
8 | import { | ||
9 | readdir, | ||
10 | readFile, | ||
11 | rename, | ||
12 | unlink, | ||
13 | writeFile, | ||
14 | access, | ||
15 | stat, | ||
16 | Stats | ||
17 | } from 'fs' | ||
18 | import * as mkdirp from 'mkdirp' | ||
19 | import * as bcrypt from 'bcrypt' | 6 | import * as bcrypt from 'bcrypt' |
20 | import * as createTorrent from 'create-torrent' | 7 | import * as createTorrent from 'create-torrent' |
21 | import * as rimraf from 'rimraf' | 8 | import { pseudoRandomBytes } from 'crypto' |
9 | import { readdir, readFile, rename, stat, Stats, unlink, writeFile } from 'fs' | ||
10 | import * as mkdirp from 'mkdirp' | ||
11 | import { join } from 'path' | ||
22 | import * as pem from 'pem' | 12 | import * as pem from 'pem' |
13 | import * as rimraf from 'rimraf' | ||
23 | 14 | ||
24 | function isTestInstance () { | 15 | function isTestInstance () { |
25 | return process.env.NODE_ENV === 'test' | 16 | return process.env.NODE_ENV === 'test' |
@@ -100,7 +91,6 @@ function promisify2WithVoid<T, U> (func: (arg1: T, arg2: U, cb: (err: any) => vo | |||
100 | } | 91 | } |
101 | } | 92 | } |
102 | 93 | ||
103 | const readFilePromise = promisify2<string, string, string>(readFile) | ||
104 | const readFileBufferPromise = promisify1<string, Buffer>(readFile) | 94 | const readFileBufferPromise = promisify1<string, Buffer>(readFile) |
105 | const unlinkPromise = promisify1WithVoid<string>(unlink) | 95 | const unlinkPromise = promisify1WithVoid<string>(unlink) |
106 | const renamePromise = promisify2WithVoid<string, string>(rename) | 96 | const renamePromise = promisify2WithVoid<string, string>(rename) |
@@ -108,7 +98,6 @@ const writeFilePromise = promisify2WithVoid<string, any>(writeFile) | |||
108 | const readdirPromise = promisify1<string, string[]>(readdir) | 98 | const readdirPromise = promisify1<string, string[]>(readdir) |
109 | const mkdirpPromise = promisify1<string, string>(mkdirp) | 99 | const mkdirpPromise = promisify1<string, string>(mkdirp) |
110 | const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes) | 100 | const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes) |
111 | const accessPromise = promisify1WithVoid<string | Buffer>(access) | ||
112 | const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey) | 101 | const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey) |
113 | const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey) | 102 | const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey) |
114 | const bcryptComparePromise = promisify2<any, string, boolean>(bcrypt.compare) | 103 | const bcryptComparePromise = promisify2<any, string, boolean>(bcrypt.compare) |
@@ -130,14 +119,12 @@ export { | |||
130 | promisify1, | 119 | promisify1, |
131 | 120 | ||
132 | readdirPromise, | 121 | readdirPromise, |
133 | readFilePromise, | ||
134 | readFileBufferPromise, | 122 | readFileBufferPromise, |
135 | unlinkPromise, | 123 | unlinkPromise, |
136 | renamePromise, | 124 | renamePromise, |
137 | writeFilePromise, | 125 | writeFilePromise, |
138 | mkdirpPromise, | 126 | mkdirpPromise, |
139 | pseudoRandomBytesPromise, | 127 | pseudoRandomBytesPromise, |
140 | accessPromise, | ||
141 | createPrivateKey, | 128 | createPrivateKey, |
142 | getPublicKey, | 129 | getPublicKey, |
143 | bcryptComparePromise, | 130 | bcryptComparePromise, |