aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/core-utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-07 15:17:17 +0200
committerChocobozzz <me@florianbigard.com>2018-08-08 09:30:31 +0200
commit3e17515e2996b79e23f569c296051a91af3fcbe4 (patch)
treed1c06c394a9f4b1d8646625612c2d5d3e02e9191 /server/helpers/core-utils.ts
parent187501f8b8e334f043ae1e9af3c9d4f45ea0e6c1 (diff)
downloadPeerTube-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.ts5
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
6import * as bcrypt from 'bcrypt' 6import * as bcrypt from 'bcrypt'
7import * as createTorrent from 'create-torrent' 7import * as createTorrent from 'create-torrent'
8import { pseudoRandomBytes } from 'crypto' 8import { createHash, pseudoRandomBytes } from 'crypto'
9import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile } from 'fs' 9import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile } from 'fs'
10import * as mkdirp from 'mkdirp' 10import * as mkdirp from 'mkdirp'
11import { isAbsolute, join } from 'path' 11import { isAbsolute, join } from 'path'
@@ -13,7 +13,6 @@ import * as pem from 'pem'
13import * as rimraf from 'rimraf' 13import * as rimraf from 'rimraf'
14import { URL } from 'url' 14import { URL } from 'url'
15import { truncate } from 'lodash' 15import { truncate } from 'lodash'
16import * as crypto from 'crypto'
17 16
18function sanitizeUrl (url: string) { 17function 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
99function sha256 (str: string) { 98function sha256 (str: string) {
100 return crypto.createHash('sha256').update(str).digest('hex') 99 return createHash('sha256').update(str).digest('hex')
101} 100}
102 101
103function promisify0<A> (func: (cb: (err: any, result: A) => void) => void): () => Promise<A> { 102function promisify0<A> (func: (cb: (err: any, result: A) => void) => void): () => Promise<A> {