Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulen Garcia Leunda <hicom150@gmail.com>2021-06-17 07:15:49 +0300
committerGitHub <noreply@github.com>2021-06-17 07:15:49 +0300
commit73c941c6eb3b539efbbbb499ab3d033531347b19 (patch)
treebe6333241137b452388f9a6548d033574f21c313 /lib/utp.js
parent711318d026b678948a3236aed5df8331d93b332c (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.js8
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 {}
+ }
+})()