node-datachannel 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build-linux.yml +109 -0
- package/.github/workflows/build-mac.yml +40 -0
- package/.github/workflows/build-win.yml +77 -0
- package/.github/workflows/npm-publish-manual.yml +23 -0
- package/CMakeLists.txt +73 -0
- package/LICENSE +504 -0
- package/README.md +180 -0
- package/cmake/toolchain/arm64.cmake +17 -0
- package/cmake/toolchain/armv7.cmake +17 -0
- package/examples/README.md +21 -0
- package/examples/client-server/client-benchmark.js +216 -0
- package/examples/client-server/client-periodic.js +176 -0
- package/examples/client-server/client.js +113 -0
- package/examples/client-server/package-lock.json +126 -0
- package/examples/client-server/package.json +16 -0
- package/examples/client-server/signaling-server.js +31 -0
- package/lib/index.d.ts +123 -0
- package/lib/index.js +2 -0
- package/node_modules/ansi-regex/index.js +4 -0
- package/node_modules/ansi-regex/license +21 -0
- package/node_modules/ansi-regex/package.json +111 -0
- package/node_modules/ansi-regex/readme.md +39 -0
- package/node_modules/aproba/LICENSE +14 -0
- package/node_modules/aproba/README.md +94 -0
- package/node_modules/aproba/index.js +105 -0
- package/node_modules/aproba/package.json +65 -0
- package/node_modules/base64-js/LICENSE +21 -0
- package/node_modules/base64-js/README.md +34 -0
- package/node_modules/base64-js/base64js.min.js +1 -0
- package/node_modules/base64-js/index.d.ts +3 -0
- package/node_modules/base64-js/index.js +150 -0
- package/node_modules/base64-js/package.json +78 -0
- package/node_modules/buffer/AUTHORS.md +70 -0
- package/node_modules/buffer/LICENSE +21 -0
- package/node_modules/buffer/README.md +410 -0
- package/node_modules/buffer/index.d.ts +186 -0
- package/node_modules/buffer/index.js +1817 -0
- package/node_modules/buffer/package.json +130 -0
- package/node_modules/chownr/LICENSE +15 -0
- package/node_modules/chownr/README.md +3 -0
- package/node_modules/chownr/chownr.js +167 -0
- package/node_modules/chownr/package.json +66 -0
- package/node_modules/code-point-at/index.js +32 -0
- package/node_modules/code-point-at/license +21 -0
- package/node_modules/code-point-at/package.json +73 -0
- package/node_modules/code-point-at/readme.md +32 -0
- package/node_modules/console-control-strings/LICENSE +13 -0
- package/node_modules/console-control-strings/README.md +145 -0
- package/node_modules/console-control-strings/README.md~ +140 -0
- package/node_modules/console-control-strings/index.js +125 -0
- package/node_modules/console-control-strings/package.json +64 -0
- package/node_modules/core-util-is/LICENSE +19 -0
- package/node_modules/core-util-is/README.md +3 -0
- package/node_modules/core-util-is/float.patch +604 -0
- package/node_modules/core-util-is/lib/util.js +107 -0
- package/node_modules/core-util-is/package.json +70 -0
- package/node_modules/core-util-is/test.js +68 -0
- package/node_modules/decompress-response/index.d.ts +29 -0
- package/node_modules/decompress-response/index.js +40 -0
- package/node_modules/decompress-response/license +9 -0
- package/node_modules/decompress-response/package.json +85 -0
- package/node_modules/decompress-response/readme.md +52 -0
- package/node_modules/deep-extend/CHANGELOG.md +46 -0
- package/node_modules/deep-extend/LICENSE +20 -0
- package/node_modules/deep-extend/README.md +91 -0
- package/node_modules/deep-extend/index.js +1 -0
- package/node_modules/deep-extend/lib/deep-extend.js +150 -0
- package/node_modules/deep-extend/package.json +95 -0
- package/node_modules/delegates/.npmignore +1 -0
- package/node_modules/delegates/History.md +22 -0
- package/node_modules/delegates/License +20 -0
- package/node_modules/delegates/Makefile +8 -0
- package/node_modules/delegates/Readme.md +94 -0
- package/node_modules/delegates/index.js +121 -0
- package/node_modules/delegates/package.json +54 -0
- package/node_modules/delegates/test/index.js +94 -0
- package/node_modules/detect-libc/.npmignore +7 -0
- package/node_modules/detect-libc/LICENSE +201 -0
- package/node_modules/detect-libc/README.md +78 -0
- package/node_modules/detect-libc/bin/detect-libc.js +18 -0
- package/node_modules/detect-libc/lib/detect-libc.js +92 -0
- package/node_modules/detect-libc/package.json +74 -0
- package/node_modules/end-of-stream/LICENSE +21 -0
- package/node_modules/end-of-stream/README.md +54 -0
- package/node_modules/end-of-stream/index.js +94 -0
- package/node_modules/end-of-stream/package.json +69 -0
- package/node_modules/expand-template/.travis.yml +6 -0
- package/node_modules/expand-template/LICENSE +21 -0
- package/node_modules/expand-template/README.md +43 -0
- package/node_modules/expand-template/index.js +26 -0
- package/node_modules/expand-template/package.json +63 -0
- package/node_modules/expand-template/test.js +67 -0
- package/node_modules/fs-constants/LICENSE +21 -0
- package/node_modules/fs-constants/README.md +26 -0
- package/node_modules/fs-constants/browser.js +1 -0
- package/node_modules/fs-constants/index.js +1 -0
- package/node_modules/fs-constants/package.json +50 -0
- package/node_modules/github-from-package/.travis.yml +4 -0
- package/node_modules/github-from-package/LICENSE +18 -0
- package/node_modules/github-from-package/example/package.json +8 -0
- package/node_modules/github-from-package/example/url.js +3 -0
- package/node_modules/github-from-package/index.js +17 -0
- package/node_modules/github-from-package/package.json +62 -0
- package/node_modules/github-from-package/readme.markdown +53 -0
- package/node_modules/github-from-package/test/a.json +8 -0
- package/node_modules/github-from-package/test/b.json +5 -0
- package/node_modules/github-from-package/test/c.json +5 -0
- package/node_modules/github-from-package/test/d.json +7 -0
- package/node_modules/github-from-package/test/e.json +5 -0
- package/node_modules/github-from-package/test/url.js +19 -0
- package/node_modules/has-unicode/LICENSE +14 -0
- package/node_modules/has-unicode/README.md +43 -0
- package/node_modules/has-unicode/index.js +16 -0
- package/node_modules/has-unicode/package.json +63 -0
- package/node_modules/ieee754/LICENSE +11 -0
- package/node_modules/ieee754/README.md +51 -0
- package/node_modules/ieee754/index.d.ts +10 -0
- package/node_modules/ieee754/index.js +85 -0
- package/node_modules/ieee754/package.json +87 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +78 -0
- package/node_modules/ini/LICENSE +15 -0
- package/node_modules/ini/README.md +102 -0
- package/node_modules/ini/ini.js +194 -0
- package/node_modules/ini/package.json +66 -0
- package/node_modules/is-fullwidth-code-point/index.js +46 -0
- package/node_modules/is-fullwidth-code-point/license +21 -0
- package/node_modules/is-fullwidth-code-point/package.json +80 -0
- package/node_modules/is-fullwidth-code-point/readme.md +39 -0
- package/node_modules/isarray/.npmignore +1 -0
- package/node_modules/isarray/.travis.yml +4 -0
- package/node_modules/isarray/Makefile +6 -0
- package/node_modules/isarray/README.md +60 -0
- package/node_modules/isarray/component.json +19 -0
- package/node_modules/isarray/index.js +5 -0
- package/node_modules/isarray/package.json +77 -0
- package/node_modules/isarray/test.js +20 -0
- package/node_modules/mimic-response/index.d.ts +17 -0
- package/node_modules/mimic-response/index.js +38 -0
- package/node_modules/mimic-response/license +9 -0
- package/node_modules/mimic-response/package.json +77 -0
- package/node_modules/mimic-response/readme.md +57 -0
- package/node_modules/minimist/.travis.yml +8 -0
- package/node_modules/minimist/LICENSE +18 -0
- package/node_modules/minimist/example/parse.js +2 -0
- package/node_modules/minimist/index.js +245 -0
- package/node_modules/minimist/package.json +80 -0
- package/node_modules/minimist/readme.markdown +95 -0
- package/node_modules/minimist/test/all_bool.js +32 -0
- package/node_modules/minimist/test/bool.js +178 -0
- package/node_modules/minimist/test/dash.js +31 -0
- package/node_modules/minimist/test/default_bool.js +35 -0
- package/node_modules/minimist/test/dotted.js +22 -0
- package/node_modules/minimist/test/kv_short.js +16 -0
- package/node_modules/minimist/test/long.js +31 -0
- package/node_modules/minimist/test/num.js +36 -0
- package/node_modules/minimist/test/parse.js +197 -0
- package/node_modules/minimist/test/parse_modified.js +9 -0
- package/node_modules/minimist/test/proto.js +44 -0
- package/node_modules/minimist/test/short.js +67 -0
- package/node_modules/minimist/test/stop_early.js +15 -0
- package/node_modules/minimist/test/unknown.js +102 -0
- package/node_modules/minimist/test/whitespace.js +8 -0
- package/node_modules/mkdirp-classic/LICENSE +21 -0
- package/node_modules/mkdirp-classic/README.md +18 -0
- package/node_modules/mkdirp-classic/index.js +98 -0
- package/node_modules/mkdirp-classic/package.json +50 -0
- package/node_modules/napi-build-utils/LICENSE +21 -0
- package/node_modules/napi-build-utils/README.md +48 -0
- package/node_modules/napi-build-utils/index.js +213 -0
- package/node_modules/napi-build-utils/index.md +81 -0
- package/node_modules/napi-build-utils/package.json +72 -0
- package/node_modules/node-abi/.github/workflows/update-abi.yml +41 -0
- package/node_modules/node-abi/.travis.yml +19 -0
- package/node_modules/node-abi/CODE_OF_CONDUCT.md +73 -0
- package/node_modules/node-abi/CONTRIBUTING.md +53 -0
- package/node_modules/node-abi/LICENSE +21 -0
- package/node_modules/node-abi/README.md +50 -0
- package/node_modules/node-abi/abi_registry.json +99 -0
- package/node_modules/node-abi/index.js +170 -0
- package/node_modules/node-abi/package.json +69 -0
- package/node_modules/node-abi/scripts/update-abi-registry.js +113 -0
- package/node_modules/node-abi/test/index.js +174 -0
- package/node_modules/noop-logger/.npmignore +1 -0
- package/node_modules/noop-logger/History.md +16 -0
- package/node_modules/noop-logger/Makefile +8 -0
- package/node_modules/noop-logger/Readme.md +27 -0
- package/node_modules/noop-logger/circle.yml +9 -0
- package/node_modules/noop-logger/lib/index.js +25 -0
- package/node_modules/noop-logger/package.json +51 -0
- package/node_modules/noop-logger/test/index.js +18 -0
- package/node_modules/npmlog/CHANGELOG.md +49 -0
- package/node_modules/npmlog/LICENSE +15 -0
- package/node_modules/npmlog/README.md +216 -0
- package/node_modules/npmlog/log.js +309 -0
- package/node_modules/npmlog/node_modules/are-we-there-yet/CHANGES.md +37 -0
- package/node_modules/npmlog/node_modules/are-we-there-yet/LICENSE +5 -0
- package/node_modules/npmlog/node_modules/are-we-there-yet/README.md +195 -0
- package/node_modules/npmlog/node_modules/are-we-there-yet/index.js +4 -0
- package/node_modules/npmlog/node_modules/are-we-there-yet/package.json +66 -0
- package/node_modules/npmlog/node_modules/are-we-there-yet/tracker-base.js +11 -0
- package/node_modules/npmlog/node_modules/are-we-there-yet/tracker-group.js +107 -0
- package/node_modules/npmlog/node_modules/are-we-there-yet/tracker-stream.js +36 -0
- package/node_modules/npmlog/node_modules/are-we-there-yet/tracker.js +30 -0
- package/node_modules/npmlog/node_modules/gauge/CHANGELOG.md +160 -0
- package/node_modules/npmlog/node_modules/gauge/LICENSE +13 -0
- package/node_modules/npmlog/node_modules/gauge/README.md +399 -0
- package/node_modules/npmlog/node_modules/gauge/base-theme.js +14 -0
- package/node_modules/npmlog/node_modules/gauge/error.js +24 -0
- package/node_modules/npmlog/node_modules/gauge/has-color.js +12 -0
- package/node_modules/npmlog/node_modules/gauge/index.js +233 -0
- package/node_modules/npmlog/node_modules/gauge/package.json +94 -0
- package/node_modules/npmlog/node_modules/gauge/plumbing.js +48 -0
- package/node_modules/npmlog/node_modules/gauge/process.js +3 -0
- package/node_modules/npmlog/node_modules/gauge/progress-bar.js +35 -0
- package/node_modules/npmlog/node_modules/gauge/render-template.js +181 -0
- package/node_modules/npmlog/node_modules/gauge/set-immediate.js +7 -0
- package/node_modules/npmlog/node_modules/gauge/set-interval.js +3 -0
- package/node_modules/npmlog/node_modules/gauge/spin.js +5 -0
- package/node_modules/npmlog/node_modules/gauge/template-item.js +73 -0
- package/node_modules/npmlog/node_modules/gauge/theme-set.js +115 -0
- package/node_modules/npmlog/node_modules/gauge/themes.js +54 -0
- package/node_modules/npmlog/node_modules/gauge/wide-truncate.js +25 -0
- package/node_modules/npmlog/package.json +78 -0
- package/node_modules/number-is-nan/index.js +4 -0
- package/node_modules/number-is-nan/license +21 -0
- package/node_modules/number-is-nan/package.json +70 -0
- package/node_modules/number-is-nan/readme.md +28 -0
- package/node_modules/object-assign/index.js +90 -0
- package/node_modules/object-assign/license +21 -0
- package/node_modules/object-assign/package.json +77 -0
- package/node_modules/object-assign/readme.md +61 -0
- package/node_modules/once/LICENSE +15 -0
- package/node_modules/once/README.md +79 -0
- package/node_modules/once/once.js +42 -0
- package/node_modules/once/package.json +74 -0
- package/node_modules/prebuild-install/.travis.yml +12 -0
- package/node_modules/prebuild-install/CHANGELOG.md +7 -0
- package/node_modules/prebuild-install/CONTRIBUTING.md +6 -0
- package/node_modules/prebuild-install/LICENSE +21 -0
- package/node_modules/prebuild-install/README.md +108 -0
- package/node_modules/prebuild-install/appveyor.yml +40 -0
- package/node_modules/prebuild-install/asset.js +48 -0
- package/node_modules/prebuild-install/bin.js +85 -0
- package/node_modules/prebuild-install/download.js +130 -0
- package/node_modules/prebuild-install/error.js +14 -0
- package/node_modules/prebuild-install/help.txt +14 -0
- package/node_modules/prebuild-install/index.js +1 -0
- package/node_modules/prebuild-install/log.js +13 -0
- package/node_modules/prebuild-install/package.json +131 -0
- package/node_modules/prebuild-install/proxy.js +38 -0
- package/node_modules/prebuild-install/rc.js +81 -0
- package/node_modules/prebuild-install/util.js +97 -0
- package/node_modules/process-nextick-args/index.js +45 -0
- package/node_modules/process-nextick-args/license.md +19 -0
- package/node_modules/process-nextick-args/package.json +53 -0
- package/node_modules/process-nextick-args/readme.md +18 -0
- package/node_modules/pump/.travis.yml +5 -0
- package/node_modules/pump/LICENSE +21 -0
- package/node_modules/pump/README.md +65 -0
- package/node_modules/pump/index.js +82 -0
- package/node_modules/pump/package.json +63 -0
- package/node_modules/pump/test-browser.js +66 -0
- package/node_modules/pump/test-node.js +53 -0
- package/node_modules/rc/LICENSE.APACHE2 +15 -0
- package/node_modules/rc/LICENSE.BSD +26 -0
- package/node_modules/rc/LICENSE.MIT +24 -0
- package/node_modules/rc/README.md +227 -0
- package/node_modules/rc/browser.js +7 -0
- package/node_modules/rc/cli.js +4 -0
- package/node_modules/rc/index.js +53 -0
- package/node_modules/rc/lib/utils.js +104 -0
- package/node_modules/rc/package.json +70 -0
- package/node_modules/rc/test/ini.js +16 -0
- package/node_modules/rc/test/nested-env-vars.js +50 -0
- package/node_modules/rc/test/test.js +59 -0
- package/node_modules/readable-stream/.travis.yml +34 -0
- package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
- package/node_modules/readable-stream/GOVERNANCE.md +136 -0
- package/node_modules/readable-stream/LICENSE +47 -0
- package/node_modules/readable-stream/README.md +58 -0
- package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +60 -0
- package/node_modules/readable-stream/duplex-browser.js +1 -0
- package/node_modules/readable-stream/duplex.js +1 -0
- package/node_modules/readable-stream/lib/_stream_duplex.js +131 -0
- package/node_modules/readable-stream/lib/_stream_passthrough.js +47 -0
- package/node_modules/readable-stream/lib/_stream_readable.js +1019 -0
- package/node_modules/readable-stream/lib/_stream_transform.js +214 -0
- package/node_modules/readable-stream/lib/_stream_writable.js +687 -0
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +79 -0
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +74 -0
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/node_modules/readable-stream/package.json +88 -0
- package/node_modules/readable-stream/passthrough.js +1 -0
- package/node_modules/readable-stream/readable-browser.js +7 -0
- package/node_modules/readable-stream/readable.js +19 -0
- package/node_modules/readable-stream/transform.js +1 -0
- package/node_modules/readable-stream/writable-browser.js +1 -0
- package/node_modules/readable-stream/writable.js +8 -0
- package/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/index.js +62 -0
- package/node_modules/safe-buffer/package.json +71 -0
- package/node_modules/semver/CHANGELOG.md +39 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +412 -0
- package/node_modules/semver/bin/semver +160 -0
- package/node_modules/semver/package.json +67 -0
- package/node_modules/semver/range.bnf +16 -0
- package/node_modules/semver/semver.js +1483 -0
- package/node_modules/set-blocking/CHANGELOG.md +26 -0
- package/node_modules/set-blocking/LICENSE.txt +14 -0
- package/node_modules/set-blocking/README.md +31 -0
- package/node_modules/set-blocking/index.js +7 -0
- package/node_modules/set-blocking/package.json +73 -0
- package/node_modules/signal-exit/CHANGELOG.md +35 -0
- package/node_modules/signal-exit/LICENSE.txt +16 -0
- package/node_modules/signal-exit/README.md +39 -0
- package/node_modules/signal-exit/index.js +163 -0
- package/node_modules/signal-exit/package.json +71 -0
- package/node_modules/signal-exit/signals.js +53 -0
- package/node_modules/simple-concat/.travis.yml +3 -0
- package/node_modules/simple-concat/LICENSE +20 -0
- package/node_modules/simple-concat/README.md +44 -0
- package/node_modules/simple-concat/index.js +15 -0
- package/node_modules/simple-concat/package.json +75 -0
- package/node_modules/simple-concat/test/basic.js +41 -0
- package/node_modules/simple-get/LICENSE +20 -0
- package/node_modules/simple-get/README.md +319 -0
- package/node_modules/simple-get/index.js +99 -0
- package/node_modules/simple-get/package.json +81 -0
- package/node_modules/string-width/index.js +37 -0
- package/node_modules/string-width/license +21 -0
- package/node_modules/string-width/package.json +96 -0
- package/node_modules/string-width/readme.md +42 -0
- package/node_modules/string_decoder/.travis.yml +50 -0
- package/node_modules/string_decoder/LICENSE +48 -0
- package/node_modules/string_decoder/README.md +47 -0
- package/node_modules/string_decoder/lib/string_decoder.js +296 -0
- package/node_modules/string_decoder/package.json +64 -0
- package/node_modules/strip-ansi/index.js +6 -0
- package/node_modules/strip-ansi/license +21 -0
- package/node_modules/strip-ansi/package.json +107 -0
- package/node_modules/strip-ansi/readme.md +33 -0
- package/node_modules/strip-json-comments/index.js +70 -0
- package/node_modules/strip-json-comments/license +21 -0
- package/node_modules/strip-json-comments/package.json +77 -0
- package/node_modules/strip-json-comments/readme.md +64 -0
- package/node_modules/tar-fs/.travis.yml +6 -0
- package/node_modules/tar-fs/LICENSE +21 -0
- package/node_modules/tar-fs/README.md +165 -0
- package/node_modules/tar-fs/index.js +351 -0
- package/node_modules/tar-fs/package.json +71 -0
- package/node_modules/tar-fs/test/fixtures/a/hello.txt +1 -0
- package/node_modules/tar-fs/test/fixtures/b/a/test.txt +1 -0
- package/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
- package/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
- package/node_modules/tar-fs/test/fixtures/e/file +0 -0
- package/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
- package/node_modules/tar-fs/test/index.js +346 -0
- package/node_modules/tar-stream/LICENSE +21 -0
- package/node_modules/tar-stream/README.md +168 -0
- package/node_modules/tar-stream/extract.js +257 -0
- package/node_modules/tar-stream/headers.js +293 -0
- package/node_modules/tar-stream/index.js +2 -0
- package/node_modules/tar-stream/node_modules/bl/.travis.yml +16 -0
- package/node_modules/tar-stream/node_modules/bl/BufferList.js +396 -0
- package/node_modules/tar-stream/node_modules/bl/LICENSE.md +13 -0
- package/node_modules/tar-stream/node_modules/bl/README.md +247 -0
- package/node_modules/tar-stream/node_modules/bl/bl.js +84 -0
- package/node_modules/tar-stream/node_modules/bl/package.json +68 -0
- package/node_modules/tar-stream/node_modules/bl/test/convert.js +21 -0
- package/node_modules/tar-stream/node_modules/bl/test/indexOf.js +492 -0
- package/node_modules/tar-stream/node_modules/bl/test/isBufferList.js +32 -0
- package/node_modules/tar-stream/node_modules/bl/test/test.js +851 -0
- package/node_modules/tar-stream/node_modules/readable-stream/CONTRIBUTING.md +38 -0
- package/node_modules/tar-stream/node_modules/readable-stream/GOVERNANCE.md +136 -0
- package/node_modules/tar-stream/node_modules/readable-stream/LICENSE +47 -0
- package/node_modules/tar-stream/node_modules/readable-stream/README.md +106 -0
- package/node_modules/tar-stream/node_modules/readable-stream/errors-browser.js +127 -0
- package/node_modules/tar-stream/node_modules/readable-stream/errors.js +116 -0
- package/node_modules/tar-stream/node_modules/readable-stream/experimentalWarning.js +17 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_duplex.js +139 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_passthrough.js +39 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_readable.js +1124 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_transform.js +201 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js +697 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/async_iterator.js +207 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/buffer_list.js +210 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/destroy.js +105 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +104 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/from.js +64 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/pipeline.js +97 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/state.js +27 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/node_modules/tar-stream/node_modules/readable-stream/package.json +101 -0
- package/node_modules/tar-stream/node_modules/readable-stream/readable-browser.js +9 -0
- package/node_modules/tar-stream/node_modules/readable-stream/readable.js +16 -0
- package/node_modules/tar-stream/pack.js +255 -0
- package/node_modules/tar-stream/package.json +95 -0
- package/node_modules/tar-stream/sandbox.js +11 -0
- package/node_modules/tunnel-agent/LICENSE +55 -0
- package/node_modules/tunnel-agent/README.md +4 -0
- package/node_modules/tunnel-agent/index.js +244 -0
- package/node_modules/tunnel-agent/package.json +59 -0
- package/node_modules/util-deprecate/History.md +16 -0
- package/node_modules/util-deprecate/LICENSE +24 -0
- package/node_modules/util-deprecate/README.md +53 -0
- package/node_modules/util-deprecate/browser.js +67 -0
- package/node_modules/util-deprecate/node.js +6 -0
- package/node_modules/util-deprecate/package.json +62 -0
- package/node_modules/which-pm-runs/LICENSE +21 -0
- package/node_modules/which-pm-runs/README.md +29 -0
- package/node_modules/which-pm-runs/index.js +17 -0
- package/node_modules/which-pm-runs/package.json +64 -0
- package/node_modules/wide-align/LICENSE +14 -0
- package/node_modules/wide-align/README.md +47 -0
- package/node_modules/wide-align/align.js +65 -0
- package/node_modules/wide-align/package.json +69 -0
- package/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/wrappy/README.md +36 -0
- package/node_modules/wrappy/package.json +62 -0
- package/node_modules/wrappy/wrappy.js +33 -0
- package/package.json +48 -0
- package/src/data-channel-wrapper.cpp +401 -0
- package/src/data-channel-wrapper.h +52 -0
- package/src/main.cpp +14 -0
- package/src/peer-connection-wrapper.cpp +720 -0
- package/src/peer-connection-wrapper.h +55 -0
- package/src/rtc-wrapper.cpp +110 -0
- package/src/rtc-wrapper.h +19 -0
- package/test/connectivity.js +100 -0
- package/test/test.js +149 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_args": [
|
|
3
|
+
[
|
|
4
|
+
"wide-align@1.1.3",
|
|
5
|
+
"/home/runner/work/node-datachannel/node-datachannel"
|
|
6
|
+
]
|
|
7
|
+
],
|
|
8
|
+
"_from": "wide-align@1.1.3",
|
|
9
|
+
"_id": "wide-align@1.1.3",
|
|
10
|
+
"_inBundle": false,
|
|
11
|
+
"_integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
|
|
12
|
+
"_location": "/wide-align",
|
|
13
|
+
"_phantomChildren": {},
|
|
14
|
+
"_requested": {
|
|
15
|
+
"type": "version",
|
|
16
|
+
"registry": true,
|
|
17
|
+
"raw": "wide-align@1.1.3",
|
|
18
|
+
"name": "wide-align",
|
|
19
|
+
"escapedName": "wide-align",
|
|
20
|
+
"rawSpec": "1.1.3",
|
|
21
|
+
"saveSpec": null,
|
|
22
|
+
"fetchSpec": "1.1.3"
|
|
23
|
+
},
|
|
24
|
+
"_requiredBy": [
|
|
25
|
+
"/npmlog/gauge"
|
|
26
|
+
],
|
|
27
|
+
"_resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
|
28
|
+
"_spec": "1.1.3",
|
|
29
|
+
"_where": "/home/runner/work/node-datachannel/node-datachannel",
|
|
30
|
+
"author": {
|
|
31
|
+
"name": "Rebecca Turner",
|
|
32
|
+
"email": "me@re-becca.org",
|
|
33
|
+
"url": "http://re-becca.org/"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/iarna/wide-align/issues"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"string-width": "^1.0.2 || 2"
|
|
40
|
+
},
|
|
41
|
+
"description": "A wide-character aware text alignment function for use on the console or with fixed width fonts.",
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"tap": "10 || 11 || 12"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"align.js"
|
|
47
|
+
],
|
|
48
|
+
"homepage": "https://github.com/iarna/wide-align#readme",
|
|
49
|
+
"keywords": [
|
|
50
|
+
"wide",
|
|
51
|
+
"double",
|
|
52
|
+
"unicode",
|
|
53
|
+
"cjkv",
|
|
54
|
+
"pad",
|
|
55
|
+
"align"
|
|
56
|
+
],
|
|
57
|
+
"license": "ISC",
|
|
58
|
+
"main": "align.js",
|
|
59
|
+
"name": "wide-align",
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "git+https://github.com/iarna/wide-align.git"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"test": "tap --coverage test/*.js",
|
|
66
|
+
"version": "perl -pi -e 's/^( \"version\": $ENV{npm_config_node_version}\").*?\",/$1abc\",/' package-lock.json ; git add package-lock.json"
|
|
67
|
+
},
|
|
68
|
+
"version": "1.1.3"
|
|
69
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
The ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
15
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# wrappy
|
|
2
|
+
|
|
3
|
+
Callback wrapping utility
|
|
4
|
+
|
|
5
|
+
## USAGE
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
var wrappy = require("wrappy")
|
|
9
|
+
|
|
10
|
+
// var wrapper = wrappy(wrapperFunction)
|
|
11
|
+
|
|
12
|
+
// make sure a cb is called only once
|
|
13
|
+
// See also: http://npm.im/once for this specific use case
|
|
14
|
+
var once = wrappy(function (cb) {
|
|
15
|
+
var called = false
|
|
16
|
+
return function () {
|
|
17
|
+
if (called) return
|
|
18
|
+
called = true
|
|
19
|
+
return cb.apply(this, arguments)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
function printBoo () {
|
|
24
|
+
console.log('boo')
|
|
25
|
+
}
|
|
26
|
+
// has some rando property
|
|
27
|
+
printBoo.iAmBooPrinter = true
|
|
28
|
+
|
|
29
|
+
var onlyPrintOnce = once(printBoo)
|
|
30
|
+
|
|
31
|
+
onlyPrintOnce() // prints 'boo'
|
|
32
|
+
onlyPrintOnce() // does nothing
|
|
33
|
+
|
|
34
|
+
// random property is retained!
|
|
35
|
+
assert.equal(onlyPrintOnce.iAmBooPrinter, true)
|
|
36
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_args": [
|
|
3
|
+
[
|
|
4
|
+
"wrappy@1.0.2",
|
|
5
|
+
"/home/runner/work/node-datachannel/node-datachannel"
|
|
6
|
+
]
|
|
7
|
+
],
|
|
8
|
+
"_from": "wrappy@1.0.2",
|
|
9
|
+
"_id": "wrappy@1.0.2",
|
|
10
|
+
"_inBundle": false,
|
|
11
|
+
"_integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
|
12
|
+
"_location": "/wrappy",
|
|
13
|
+
"_phantomChildren": {},
|
|
14
|
+
"_requested": {
|
|
15
|
+
"type": "version",
|
|
16
|
+
"registry": true,
|
|
17
|
+
"raw": "wrappy@1.0.2",
|
|
18
|
+
"name": "wrappy",
|
|
19
|
+
"escapedName": "wrappy",
|
|
20
|
+
"rawSpec": "1.0.2",
|
|
21
|
+
"saveSpec": null,
|
|
22
|
+
"fetchSpec": "1.0.2"
|
|
23
|
+
},
|
|
24
|
+
"_requiredBy": [
|
|
25
|
+
"/inflight",
|
|
26
|
+
"/once"
|
|
27
|
+
],
|
|
28
|
+
"_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
|
29
|
+
"_spec": "1.0.2",
|
|
30
|
+
"_where": "/home/runner/work/node-datachannel/node-datachannel",
|
|
31
|
+
"author": {
|
|
32
|
+
"name": "Isaac Z. Schlueter",
|
|
33
|
+
"email": "i@izs.me",
|
|
34
|
+
"url": "http://blog.izs.me/"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/npm/wrappy/issues"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {},
|
|
40
|
+
"description": "Callback wrapping utility",
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"tap": "^2.3.1"
|
|
43
|
+
},
|
|
44
|
+
"directories": {
|
|
45
|
+
"test": "test"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"wrappy.js"
|
|
49
|
+
],
|
|
50
|
+
"homepage": "https://github.com/npm/wrappy",
|
|
51
|
+
"license": "ISC",
|
|
52
|
+
"main": "wrappy.js",
|
|
53
|
+
"name": "wrappy",
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://github.com/npm/wrappy.git"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"test": "tap --coverage test/*.js"
|
|
60
|
+
},
|
|
61
|
+
"version": "1.0.2"
|
|
62
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Returns a wrapper function that returns a wrapped callback
|
|
2
|
+
// The wrapper function should do some stuff, and return a
|
|
3
|
+
// presumably different callback function.
|
|
4
|
+
// This makes sure that own properties are retained, so that
|
|
5
|
+
// decorations and such are not lost along the way.
|
|
6
|
+
module.exports = wrappy
|
|
7
|
+
function wrappy (fn, cb) {
|
|
8
|
+
if (fn && cb) return wrappy(fn)(cb)
|
|
9
|
+
|
|
10
|
+
if (typeof fn !== 'function')
|
|
11
|
+
throw new TypeError('need wrapper function')
|
|
12
|
+
|
|
13
|
+
Object.keys(fn).forEach(function (k) {
|
|
14
|
+
wrapper[k] = fn[k]
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
return wrapper
|
|
18
|
+
|
|
19
|
+
function wrapper() {
|
|
20
|
+
var args = new Array(arguments.length)
|
|
21
|
+
for (var i = 0; i < args.length; i++) {
|
|
22
|
+
args[i] = arguments[i]
|
|
23
|
+
}
|
|
24
|
+
var ret = fn.apply(this, args)
|
|
25
|
+
var cb = args[args.length-1]
|
|
26
|
+
if (typeof ret === 'function' && ret !== cb) {
|
|
27
|
+
Object.keys(cb).forEach(function (k) {
|
|
28
|
+
ret[k] = cb[k]
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
return ret
|
|
32
|
+
}
|
|
33
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "node-datachannel",
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"description": "libdatachannel node bindings",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"typings": "lib/index.d.ts",
|
|
7
|
+
"directories": {
|
|
8
|
+
"lib": "lib",
|
|
9
|
+
"test": "test"
|
|
10
|
+
},
|
|
11
|
+
"_from": "node-datachannel@latest",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"install": "prebuild-install || (npm install --ignore-scripts && npm run _prebuild)",
|
|
14
|
+
"install-nice": "npm run clean && cmake-js build --CDUSE_NICE=1",
|
|
15
|
+
"build": "cmake-js build",
|
|
16
|
+
"_prebuild": "prebuild --backend cmake-js",
|
|
17
|
+
"clean": "cmake-js clean",
|
|
18
|
+
"test": "jest --forceExit"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/murat-dogan/node-datachannel.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"libdatachannel"
|
|
26
|
+
],
|
|
27
|
+
"author": "Murat Doğan",
|
|
28
|
+
"license": "GPL-2.0-or-later",
|
|
29
|
+
"gypfile": true,
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/murat-dogan/node-datachannel/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/murat-dogan/node-datachannel#readme",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"cmake-js": "^6.1.0",
|
|
36
|
+
"jest": "^27.0.6",
|
|
37
|
+
"nan": "^2.14.2",
|
|
38
|
+
"napi-thread-safe-callback": "0.0.6",
|
|
39
|
+
"node-addon-api": "^3.1.0",
|
|
40
|
+
"prebuild": "^10.0.1"
|
|
41
|
+
},
|
|
42
|
+
"bundledDependencies": [
|
|
43
|
+
"prebuild-install"
|
|
44
|
+
],
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"prebuild-install": "^5.3.6"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
#include "data-channel-wrapper.h"
|
|
2
|
+
|
|
3
|
+
Napi::FunctionReference DataChannelWrapper::constructor;
|
|
4
|
+
|
|
5
|
+
Napi::Object DataChannelWrapper::Init(Napi::Env env, Napi::Object exports)
|
|
6
|
+
{
|
|
7
|
+
Napi::HandleScope scope(env);
|
|
8
|
+
|
|
9
|
+
Napi::Function func = DefineClass(
|
|
10
|
+
env,
|
|
11
|
+
"DataChannel",
|
|
12
|
+
{InstanceMethod("close", &DataChannelWrapper::close),
|
|
13
|
+
InstanceMethod("getLabel", &DataChannelWrapper::getLabel),
|
|
14
|
+
InstanceMethod("sendMessage", &DataChannelWrapper::sendMessage),
|
|
15
|
+
InstanceMethod("sendMessageBinary", &DataChannelWrapper::sendMessageBinary),
|
|
16
|
+
InstanceMethod("isOpen", &DataChannelWrapper::isOpen),
|
|
17
|
+
InstanceMethod("availableAmount", &DataChannelWrapper::availableAmount),
|
|
18
|
+
InstanceMethod("bufferedAmount", &DataChannelWrapper::bufferedAmount),
|
|
19
|
+
InstanceMethod("maxMessageSize", &DataChannelWrapper::maxMessageSize),
|
|
20
|
+
InstanceMethod("setBufferedAmountLowThreshold", &DataChannelWrapper::setBufferedAmountLowThreshold),
|
|
21
|
+
InstanceMethod("onOpen", &DataChannelWrapper::onOpen),
|
|
22
|
+
InstanceMethod("onClosed", &DataChannelWrapper::onClosed),
|
|
23
|
+
InstanceMethod("onError", &DataChannelWrapper::onError),
|
|
24
|
+
InstanceMethod("onAvailable", &DataChannelWrapper::onAvailable),
|
|
25
|
+
InstanceMethod("onBufferedAmountLow", &DataChannelWrapper::onBufferedAmountLow),
|
|
26
|
+
InstanceMethod("onMessage", &DataChannelWrapper::onMessage)});
|
|
27
|
+
|
|
28
|
+
constructor = Napi::Persistent(func);
|
|
29
|
+
constructor.SuppressDestruct();
|
|
30
|
+
|
|
31
|
+
exports.Set("DataChannel", func);
|
|
32
|
+
return exports;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
DataChannelWrapper::DataChannelWrapper(const Napi::CallbackInfo &info) : Napi::ObjectWrap<DataChannelWrapper>(info)
|
|
36
|
+
{
|
|
37
|
+
mDataChannelPtr = *(info[0].As<Napi::External<std::shared_ptr<rtc::DataChannel>>>().Data());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
DataChannelWrapper::~DataChannelWrapper()
|
|
41
|
+
{
|
|
42
|
+
if (mDataChannelPtr)
|
|
43
|
+
{
|
|
44
|
+
try
|
|
45
|
+
{
|
|
46
|
+
mDataChannelPtr->close();
|
|
47
|
+
mDataChannelPtr.reset();
|
|
48
|
+
}
|
|
49
|
+
catch (std::exception &ex)
|
|
50
|
+
{
|
|
51
|
+
std::cout << std::string("libdatachannel error while closing dataChannel# ") + ex.what() << std::endl;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void DataChannelWrapper::close(const Napi::CallbackInfo &info)
|
|
58
|
+
{
|
|
59
|
+
Napi::Env env = info.Env();
|
|
60
|
+
if (!mDataChannelPtr)
|
|
61
|
+
{
|
|
62
|
+
Napi::Error::New(env, "It seems data-channel is destroyed!").ThrowAsJavaScriptException();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
try
|
|
67
|
+
{
|
|
68
|
+
mDataChannelPtr->close();
|
|
69
|
+
mDataChannelPtr.reset();
|
|
70
|
+
}
|
|
71
|
+
catch (std::exception &ex)
|
|
72
|
+
{
|
|
73
|
+
Napi::Error::New(env, std::string("libdatachannel error while closing dataChannel# ") + ex.what()).ThrowAsJavaScriptException();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
Napi::Value DataChannelWrapper::getLabel(const Napi::CallbackInfo &info)
|
|
79
|
+
{
|
|
80
|
+
if (!mDataChannelPtr)
|
|
81
|
+
{
|
|
82
|
+
Napi::Error::New(info.Env(), "It seems data-channel is destroyed!").ThrowAsJavaScriptException();
|
|
83
|
+
return info.Env().Null();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return Napi::String::New(info.Env(), mDataChannelPtr->label());
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
Napi::Value DataChannelWrapper::sendMessage(const Napi::CallbackInfo &info)
|
|
90
|
+
{
|
|
91
|
+
if (!mDataChannelPtr)
|
|
92
|
+
{
|
|
93
|
+
Napi::Error::New(info.Env(), "It seems data-channel is destroyed!").ThrowAsJavaScriptException();
|
|
94
|
+
return info.Env().Null();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
Napi::Env env = info.Env();
|
|
98
|
+
int length = info.Length();
|
|
99
|
+
|
|
100
|
+
// Allow call with NULL
|
|
101
|
+
if (length < 1 || (!info[0].IsString() && !info[0].IsNull()))
|
|
102
|
+
{
|
|
103
|
+
Napi::TypeError::New(env, "String or Null expected").ThrowAsJavaScriptException();
|
|
104
|
+
return info.Env().Null();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
try
|
|
108
|
+
{
|
|
109
|
+
return Napi::Boolean::New(info.Env(), mDataChannelPtr->send(info[0].As<Napi::String>().ToString()));
|
|
110
|
+
}
|
|
111
|
+
catch (std::exception &ex)
|
|
112
|
+
{
|
|
113
|
+
Napi::Error::New(env, std::string("libdatachannel error while sending dataChannel msg# ") + ex.what()).ThrowAsJavaScriptException();
|
|
114
|
+
return Napi::Boolean::New(info.Env(), false);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
Napi::Value DataChannelWrapper::sendMessageBinary(const Napi::CallbackInfo &info)
|
|
119
|
+
{
|
|
120
|
+
if (!mDataChannelPtr)
|
|
121
|
+
{
|
|
122
|
+
Napi::Error::New(info.Env(), "It seems data-channel is destroyed!").ThrowAsJavaScriptException();
|
|
123
|
+
return info.Env().Null();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
Napi::Env env = info.Env();
|
|
127
|
+
int length = info.Length();
|
|
128
|
+
|
|
129
|
+
if (length < 1 || !info[0].IsBuffer())
|
|
130
|
+
{
|
|
131
|
+
Napi::TypeError::New(env, "Buffer expected").ThrowAsJavaScriptException();
|
|
132
|
+
return info.Env().Null();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
try
|
|
136
|
+
{
|
|
137
|
+
Napi::Uint8Array buffer = info[0].As<Napi::Uint8Array>();
|
|
138
|
+
return Napi::Boolean::New(info.Env(), mDataChannelPtr->send((std::byte *)buffer.Data(), buffer.ByteLength()));
|
|
139
|
+
}
|
|
140
|
+
catch (std::exception &ex)
|
|
141
|
+
{
|
|
142
|
+
Napi::Error::New(env, std::string("libdatachannel error while sending dataChannel msg# ") + ex.what()).ThrowAsJavaScriptException();
|
|
143
|
+
return Napi::Boolean::New(info.Env(), false);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
Napi::Value DataChannelWrapper::isOpen(const Napi::CallbackInfo &info)
|
|
148
|
+
{
|
|
149
|
+
Napi::Env env = info.Env();
|
|
150
|
+
if (!mDataChannelPtr)
|
|
151
|
+
{
|
|
152
|
+
return Napi::Boolean::New(info.Env(), false);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
try
|
|
156
|
+
{
|
|
157
|
+
return Napi::Boolean::New(info.Env(), mDataChannelPtr->isOpen());
|
|
158
|
+
}
|
|
159
|
+
catch (std::exception &ex)
|
|
160
|
+
{
|
|
161
|
+
Napi::Error::New(env, std::string("libdatachannel error# ") + ex.what()).ThrowAsJavaScriptException();
|
|
162
|
+
return Napi::Boolean::New(info.Env(), false);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
Napi::Value DataChannelWrapper::availableAmount(const Napi::CallbackInfo &info)
|
|
167
|
+
{
|
|
168
|
+
Napi::Env env = info.Env();
|
|
169
|
+
if (!mDataChannelPtr)
|
|
170
|
+
{
|
|
171
|
+
return Napi::Number::New(info.Env(), 0);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
try
|
|
175
|
+
{
|
|
176
|
+
return Napi::Number::New(info.Env(), mDataChannelPtr->availableAmount());
|
|
177
|
+
}
|
|
178
|
+
catch (std::exception &ex)
|
|
179
|
+
{
|
|
180
|
+
Napi::Error::New(env, std::string("libdatachannel error# ") + ex.what()).ThrowAsJavaScriptException();
|
|
181
|
+
return Napi::Number::New(info.Env(), 0);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
Napi::Value DataChannelWrapper::bufferedAmount(const Napi::CallbackInfo &info)
|
|
186
|
+
{
|
|
187
|
+
Napi::Env env = info.Env();
|
|
188
|
+
if (!mDataChannelPtr)
|
|
189
|
+
{
|
|
190
|
+
return Napi::Number::New(info.Env(), 0);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
try
|
|
194
|
+
{
|
|
195
|
+
return Napi::Number::New(info.Env(), mDataChannelPtr->bufferedAmount());
|
|
196
|
+
}
|
|
197
|
+
catch (std::exception &ex)
|
|
198
|
+
{
|
|
199
|
+
Napi::Error::New(env, std::string("libdatachannel error# ") + ex.what()).ThrowAsJavaScriptException();
|
|
200
|
+
return Napi::Number::New(info.Env(), 0);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
Napi::Value DataChannelWrapper::maxMessageSize(const Napi::CallbackInfo &info)
|
|
205
|
+
{
|
|
206
|
+
Napi::Env env = info.Env();
|
|
207
|
+
if (!mDataChannelPtr)
|
|
208
|
+
{
|
|
209
|
+
return Napi::Number::New(info.Env(), 0);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
try
|
|
213
|
+
{
|
|
214
|
+
return Napi::Number::New(info.Env(), mDataChannelPtr->maxMessageSize());
|
|
215
|
+
}
|
|
216
|
+
catch (std::exception &ex)
|
|
217
|
+
{
|
|
218
|
+
Napi::Error::New(env, std::string("libdatachannel error# ") + ex.what()).ThrowAsJavaScriptException();
|
|
219
|
+
return Napi::Number::New(info.Env(), 0);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
void DataChannelWrapper::setBufferedAmountLowThreshold(const Napi::CallbackInfo &info)
|
|
224
|
+
{
|
|
225
|
+
if (!mDataChannelPtr)
|
|
226
|
+
{
|
|
227
|
+
Napi::Error::New(info.Env(), "It seems data-channel is destroyed!").ThrowAsJavaScriptException();
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
Napi::Env env = info.Env();
|
|
232
|
+
int length = info.Length();
|
|
233
|
+
|
|
234
|
+
if (length < 1 || !info[0].IsNumber())
|
|
235
|
+
{
|
|
236
|
+
Napi::TypeError::New(env, "Number expected").ThrowAsJavaScriptException();
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
try
|
|
241
|
+
{
|
|
242
|
+
mDataChannelPtr->setBufferedAmountLowThreshold(info[0].ToNumber().Uint32Value());
|
|
243
|
+
}
|
|
244
|
+
catch (std::exception &ex)
|
|
245
|
+
{
|
|
246
|
+
Napi::Error::New(env, std::string("libdatachannel error# ") + ex.what()).ThrowAsJavaScriptException();
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
void DataChannelWrapper::onOpen(const Napi::CallbackInfo &info)
|
|
252
|
+
{
|
|
253
|
+
Napi::Env env = info.Env();
|
|
254
|
+
int length = info.Length();
|
|
255
|
+
|
|
256
|
+
if (length < 1 || !info[0].IsFunction())
|
|
257
|
+
{
|
|
258
|
+
Napi::TypeError::New(env, "Function expected").ThrowAsJavaScriptException();
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Callback
|
|
263
|
+
mOnOpenCallback = std::make_shared<ThreadSafeCallback>(info[0].As<Napi::Function>());
|
|
264
|
+
|
|
265
|
+
mDataChannelPtr->onOpen([&]() {
|
|
266
|
+
if (mOnOpenCallback)
|
|
267
|
+
mOnOpenCallback->call([](Napi::Env env, std::vector<napi_value> &args) {
|
|
268
|
+
// This will run in main thread and needs to construct the
|
|
269
|
+
// arguments for the call
|
|
270
|
+
args = {};
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
void DataChannelWrapper::onClosed(const Napi::CallbackInfo &info)
|
|
276
|
+
{
|
|
277
|
+
Napi::Env env = info.Env();
|
|
278
|
+
int length = info.Length();
|
|
279
|
+
|
|
280
|
+
if (length < 1 || !info[0].IsFunction())
|
|
281
|
+
{
|
|
282
|
+
Napi::TypeError::New(env, "Function expected").ThrowAsJavaScriptException();
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Callback
|
|
287
|
+
mOnClosedCallback = std::make_shared<ThreadSafeCallback>(info[0].As<Napi::Function>());
|
|
288
|
+
|
|
289
|
+
mDataChannelPtr->onClosed([&]() {
|
|
290
|
+
if (mOnClosedCallback)
|
|
291
|
+
mOnClosedCallback->call([](Napi::Env env, std::vector<napi_value> &args) {
|
|
292
|
+
// This will run in main thread and needs to construct the
|
|
293
|
+
// arguments for the call
|
|
294
|
+
args = {};
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
void DataChannelWrapper::onError(const Napi::CallbackInfo &info)
|
|
300
|
+
{
|
|
301
|
+
Napi::Env env = info.Env();
|
|
302
|
+
int length = info.Length();
|
|
303
|
+
|
|
304
|
+
if (length < 1 || !info[0].IsFunction())
|
|
305
|
+
{
|
|
306
|
+
Napi::TypeError::New(env, "Function expected").ThrowAsJavaScriptException();
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Callback
|
|
311
|
+
mOnErrorCallback = std::make_shared<ThreadSafeCallback>(info[0].As<Napi::Function>());
|
|
312
|
+
|
|
313
|
+
mDataChannelPtr->onError([&](const std::string &error) {
|
|
314
|
+
if (mOnErrorCallback)
|
|
315
|
+
mOnErrorCallback->call([error](Napi::Env env, std::vector<napi_value> &args) {
|
|
316
|
+
// This will run in main thread and needs to construct the
|
|
317
|
+
// arguments for the call
|
|
318
|
+
args = {Napi::String::New(env, error)};
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
void DataChannelWrapper::onAvailable(const Napi::CallbackInfo &info)
|
|
324
|
+
{
|
|
325
|
+
Napi::Env env = info.Env();
|
|
326
|
+
int length = info.Length();
|
|
327
|
+
|
|
328
|
+
if (length < 1 || !info[0].IsFunction())
|
|
329
|
+
{
|
|
330
|
+
Napi::TypeError::New(env, "Function expected").ThrowAsJavaScriptException();
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Callback
|
|
335
|
+
mOnAvailableCallback = std::make_shared<ThreadSafeCallback>(info[0].As<Napi::Function>());
|
|
336
|
+
|
|
337
|
+
mDataChannelPtr->onAvailable([&]() {
|
|
338
|
+
if (mOnAvailableCallback)
|
|
339
|
+
mOnAvailableCallback->call([](Napi::Env env, std::vector<napi_value> &args) {
|
|
340
|
+
// This will run in main thread and needs to construct the
|
|
341
|
+
// arguments for the call
|
|
342
|
+
args = {};
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
void DataChannelWrapper::onBufferedAmountLow(const Napi::CallbackInfo &info)
|
|
348
|
+
{
|
|
349
|
+
Napi::Env env = info.Env();
|
|
350
|
+
int length = info.Length();
|
|
351
|
+
|
|
352
|
+
if (length < 1 || !info[0].IsFunction())
|
|
353
|
+
{
|
|
354
|
+
Napi::TypeError::New(env, "Function expected").ThrowAsJavaScriptException();
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Callback
|
|
359
|
+
mOnBufferedAmountLowCallback = std::make_shared<ThreadSafeCallback>(info[0].As<Napi::Function>());
|
|
360
|
+
|
|
361
|
+
mDataChannelPtr->onBufferedAmountLow([&]() {
|
|
362
|
+
if (mOnBufferedAmountLowCallback)
|
|
363
|
+
mOnBufferedAmountLowCallback->call([](Napi::Env env, std::vector<napi_value> &args) {
|
|
364
|
+
// This will run in main thread and needs to construct the
|
|
365
|
+
// arguments for the call
|
|
366
|
+
args = {};
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
void DataChannelWrapper::onMessage(const Napi::CallbackInfo &info)
|
|
372
|
+
{
|
|
373
|
+
Napi::Env env = info.Env();
|
|
374
|
+
int length = info.Length();
|
|
375
|
+
|
|
376
|
+
if (length < 1 || !info[0].IsFunction())
|
|
377
|
+
{
|
|
378
|
+
Napi::TypeError::New(env, "Function expected").ThrowAsJavaScriptException();
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Callback
|
|
383
|
+
mOnMessageCallback = std::make_shared<ThreadSafeCallback>(info[0].As<Napi::Function>());
|
|
384
|
+
|
|
385
|
+
mDataChannelPtr->onMessage([&](const std::variant<rtc::binary, std::string> &message) {
|
|
386
|
+
if (mOnMessageCallback)
|
|
387
|
+
mOnMessageCallback->call([message](Napi::Env env, std::vector<napi_value> &args) {
|
|
388
|
+
// This will run in main thread and needs to construct the
|
|
389
|
+
// arguments for the call
|
|
390
|
+
Napi::Object payload = Napi::Object::New(env);
|
|
391
|
+
if (std::holds_alternative<std::string>(message))
|
|
392
|
+
{
|
|
393
|
+
args = {Napi::String::New(env, std::get<std::string>(message))};
|
|
394
|
+
}
|
|
395
|
+
else
|
|
396
|
+
{
|
|
397
|
+
args = {Napi::Buffer<std::byte>::Copy(env, std::get<rtc::binary>(message).data(), std::get<rtc::binary>(message).size())};
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
}
|