diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-07 15:17:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-08 09:30:31 +0200 |
commit | 3e17515e2996b79e23f569c296051a91af3fcbe4 (patch) | |
tree | d1c06c394a9f4b1d8646625612c2d5d3e02e9191 /server/helpers/core-utils.ts | |
parent | 187501f8b8e334f043ae1e9af3c9d4f45ea0e6c1 (diff) | |
download | PeerTube-3e17515e2996b79e23f569c296051a91af3fcbe4.tar.gz PeerTube-3e17515e2996b79e23f569c296051a91af3fcbe4.tar.zst PeerTube-3e17515e2996b79e23f569c296051a91af3fcbe4.zip |
Add torrent tests
Diffstat (limited to 'server/helpers/core-utils.ts')
-rw-r--r-- | server/helpers/core-utils.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts index 25eb6454a..3b38da66c 100644 --- a/server/helpers/core-utils.ts +++ b/server/helpers/core-utils.ts | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
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 { pseudoRandomBytes } from 'crypto' | 8 | import { createHash, pseudoRandomBytes } from 'crypto' |
9 | import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile } from 'fs' | 9 | import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile } from 'fs' |
10 | import * as mkdirp from 'mkdirp' | 10 | import * as mkdirp from 'mkdirp' |
11 | import { isAbsolute, join } from 'path' | 11 | import { isAbsolute, join } from 'path' |
@@ -13,7 +13,6 @@ import * as pem from 'pem' | |||
13 | import * as rimraf from 'rimraf' | 13 | import * as rimraf from 'rimraf' |
14 | import { URL } from 'url' | 14 | import { URL } from 'url' |
15 | import { truncate } from 'lodash' | 15 | import { truncate } from 'lodash' |
16 | import * as crypto from 'crypto' | ||
17 | 16 | ||
18 | function sanitizeUrl (url: string) { | 17 | function sanitizeUrl (url: string) { |
19 | const urlObject = new URL(url) | 18 | const urlObject = new URL(url) |
@@ -97,7 +96,7 @@ function peertubeTruncate (str: string, maxLength: number) { | |||
97 | } | 96 | } |
98 | 97 | ||
99 | function sha256 (str: string) { | 98 | function sha256 (str: string) { |
100 | return crypto.createHash('sha256').update(str).digest('hex') | 99 | return createHash('sha256').update(str).digest('hex') |
101 | } | 100 | } |
102 | 101 | ||
103 | function promisify0<A> (func: (cb: (err: any, result: A) => void) => void): () => Promise<A> { | 102 | function promisify0<A> (func: (cb: (err: any, result: A) => void) => void): () => Promise<A> { |