diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-10 21:19:24 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-10 21:19:24 +0200 |
commit | cbe2f7c34822b1bd3b1f8c691f79f0c29cf21f07 (patch) | |
tree | ce678124210db8b03b2a523e3b92a14cc403eeee /server/helpers | |
parent | f1dae018681936b556b2496b7f2d872c004cfda3 (diff) | |
download | PeerTube-cbe2f7c34822b1bd3b1f8c691f79f0c29cf21f07.tar.gz PeerTube-cbe2f7c34822b1bd3b1f8c691f79f0c29cf21f07.tar.zst PeerTube-cbe2f7c34822b1bd3b1f8c691f79f0c29cf21f07.zip |
Refractoring and add thumbnails support (without tests)
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/utils.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/server/helpers/utils.js b/server/helpers/utils.js index 1f7839673..9d4d51c46 100644 --- a/server/helpers/utils.js +++ b/server/helpers/utils.js | |||
@@ -1,9 +1,20 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const crypto = require('crypto') | ||
4 | |||
3 | const logger = require('./logger') | 5 | const logger = require('./logger') |
4 | 6 | ||
5 | const utils = { | 7 | const utils = { |
6 | cleanForExit: cleanForExit | 8 | cleanForExit: cleanForExit, |
9 | generateRandomString: generateRandomString | ||
10 | } | ||
11 | |||
12 | function generateRandomString (size, callback) { | ||
13 | crypto.pseudoRandomBytes(size, function (err, raw) { | ||
14 | if (err) return callback(err) | ||
15 | |||
16 | callback(null, raw.toString('hex')) | ||
17 | }) | ||
7 | } | 18 | } |
8 | 19 | ||
9 | function cleanForExit (webtorrent_process) { | 20 | function cleanForExit (webtorrent_process) { |