diff options
author | Julen Garcia Leunda <hicom150@gmail.com> | 2021-06-17 07:15:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-17 07:15:49 +0300 |
commit | 73c941c6eb3b539efbbbb499ab3d033531347b19 (patch) | |
tree | be6333241137b452388f9a6548d033574f21c313 /lib/utp.js | |
parent | 711318d026b678948a3236aed5df8331d93b332c (diff) |
fix: make utp-native optional (#1966)
* Add optional utp-native
* Add error log when uTP cannot be loaded
* Fix review suggestions
* Remove an additional require call
Co-authored-by: Alex <alxmorais8@msn.com>
Diffstat (limited to 'lib/utp.js')
-rw-r--r-- | lib/utp.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/utp.js b/lib/utp.js new file mode 100644 index 0000000..2cde3f4 --- /dev/null +++ b/lib/utp.js @@ -0,0 +1,8 @@ +module.exports = (() => { + try { + return require('utp-native') + } catch (err) { + console.warn('WebTorrent: uTP not supported') + return {} + } +})() |