@thaunknown/simple-peer
Advanced tools
Comparing version 9.11.1 to 9.12.0
31
index.js
/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
const debug = require('debug')('simple-peer') | ||
const getBrowserRTC = require('get-browser-rtc') | ||
const randombytes = require('randombytes') | ||
const { Duplex } = require('streamx') | ||
const queueMicrotask = require('queue-microtask') // TODO: remove when Node 10 is not supported | ||
const errCode = require('err-code') | ||
const { Buffer } = require('buffer') | ||
import debug from 'debug' | ||
import getBrowserRTC from 'get-browser-rtc' | ||
import { Duplex } from 'streamx' | ||
import queueMicrotask from 'queue-microtask' // TODO: remove when Node 10 is not supported | ||
import errCode from 'err-code' | ||
import { randomBytes, arr2hex, text2arr } from 'uint8-util' | ||
const Debug = debug('simple-peer') | ||
const MAX_BUFFERED_AMOUNT = 64 * 1024 | ||
@@ -38,7 +39,7 @@ const ICECOMPLETE_TIMEOUT = 5 * 1000 | ||
this._id = randombytes(4).toString('hex').slice(0, 7) | ||
this._id = arr2hex(randomBytes(4)).slice(0, 7) | ||
this._debug('new peer %o', opts) | ||
this.channelName = opts.initiator | ||
? opts.channelName || randombytes(20).toString('hex') | ||
? opts.channelName || arr2hex(randomBytes(20)) | ||
: null | ||
@@ -246,3 +247,3 @@ | ||
* Send text/binary data to the remote peer. | ||
* @param {ArrayBufferView|ArrayBuffer|Buffer|string|Blob} chunk | ||
* @param {ArrayBufferView|ArrayBuffer|Uint8Array|string|Blob} chunk | ||
*/ | ||
@@ -967,3 +968,7 @@ send (chunk) { | ||
let data = event.data | ||
if (data instanceof ArrayBuffer || this.__objectMode === false) data = Buffer.from(data) | ||
if (data instanceof ArrayBuffer) { | ||
data = new Uint8Array(data) | ||
} else if (this.__objectMode === false) { | ||
data = text2arr(data) | ||
} | ||
this.push(data) | ||
@@ -1020,3 +1025,3 @@ } | ||
args[0] = '[' + this._id + '] ' + args[0] | ||
debug.apply(null, args) | ||
Debug.apply(null, args) | ||
} | ||
@@ -1046,2 +1051,2 @@ } | ||
module.exports = Peer | ||
export default Peer |
{ | ||
"name": "@thaunknown/simple-peer", | ||
"description": "Simple one-to-one WebRTC video/voice and data channels", | ||
"version": "9.11.1", | ||
"version": "9.12.0", | ||
"type": "module", | ||
"author": { | ||
@@ -13,4 +14,6 @@ "name": "ThaUnknown", | ||
}, | ||
"browser": { | ||
"wrtc": false | ||
}, | ||
"dependencies": { | ||
"buffer": "^6.0.3", | ||
"debug": "^4.3.2", | ||
@@ -20,10 +23,13 @@ "err-code": "^3.0.1", | ||
"queue-microtask": "^1.2.3", | ||
"randombytes": "^2.1.0", | ||
"streamx": "^2.13.2" | ||
"streamx": "^2.13.2", | ||
"uint8-util": "^2.1.9" | ||
}, | ||
"devDependencies": { | ||
"airtap": "^4.0.3", | ||
"@babel/core": "^7.20.12", | ||
"@babel/preset-env": "^7.20.2", | ||
"airtap": "^4.0.4", | ||
"airtap-manual": "^1.0.0", | ||
"babel-minify": "^0.5.2", | ||
"babelify": "^10.0.0", | ||
"airtap-sauce": "^1.1.0", | ||
"babel-minify": "^0.5.1", | ||
"bowser": "^2.11.0", | ||
@@ -77,3 +83,3 @@ "browserify": "^17.0.0", | ||
"test-browser": "airtap --coverage --concurrency 1 -- test/*.js", | ||
"test-browser-local": "airtap --coverage --preset local -- test/*.js", | ||
"test-browser-local": "airtap --preset local -- test/*.js", | ||
"test-node": "set WRTC=wrtc && tape test/*.js", | ||
@@ -80,0 +86,0 @@ "coverage": "nyc report --reporter=text-lcov | coveralls" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
163536
6
922
Yes
20
+ Addeduint8-util@^2.1.9
+ Addedbase64-arraybuffer@1.0.2(transitive)
+ Addeduint8-util@2.2.5(transitive)
- Removedbuffer@^6.0.3
- Removedrandombytes@^2.1.0
- Removedbase64-js@1.5.1(transitive)
- Removedbuffer@6.0.3(transitive)
- Removedieee754@1.2.1(transitive)
- Removedrandombytes@2.1.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)