1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Add torrent tests

This commit is contained in:
Chocobozzz 2018-08-07 15:17:17 +02:00
parent 187501f8b8
commit 3e17515e29
11 changed files with 144 additions and 59 deletions

View file

@ -5,7 +5,7 @@
import * as bcrypt from 'bcrypt'
import * as createTorrent from 'create-torrent'
import { pseudoRandomBytes } from 'crypto'
import { createHash, pseudoRandomBytes } from 'crypto'
import { copyFile, readdir, readFile, rename, stat, Stats, unlink, writeFile } from 'fs'
import * as mkdirp from 'mkdirp'
import { isAbsolute, join } from 'path'
@ -13,7 +13,6 @@ import * as pem from 'pem'
import * as rimraf from 'rimraf'
import { URL } from 'url'
import { truncate } from 'lodash'
import * as crypto from 'crypto'
function sanitizeUrl (url: string) {
const urlObject = new URL(url)
@ -97,7 +96,7 @@ function peertubeTruncate (str: string, maxLength: number) {
}
function sha256 (str: string) {
return crypto.createHash('sha256').update(str).digest('hex')
return createHash('sha256').update(str).digest('hex')
}
function promisify0<A> (func: (cb: (err: any, result: A) => void) => void): () => Promise<A> {