aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/utils.js')
-rw-r--r--server/helpers/utils.js13
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
3const crypto = require('crypto')
4
3const logger = require('./logger') 5const logger = require('./logger')
4 6
5const utils = { 7const utils = {
6 cleanForExit: cleanForExit 8 cleanForExit: cleanForExit,
9 generateRandomString: generateRandomString
10}
11
12function 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
9function cleanForExit (webtorrent_process) { 20function cleanForExit (webtorrent_process) {