Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

budp

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

budp - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

12

lib/udp-browser.js

@@ -42,3 +42,5 @@ /*!

async bind() {
this.emit('listening');
const address = this.address();
this.emit('listening', address);
return address;
}

@@ -55,9 +57,13 @@

getRecvBufferSize() {
return 0;
return 512;
}
getSendBufferSize() {
return 0;
return 512;
}
hasBufferSize() {
return true;
}
ref() {

@@ -64,0 +70,0 @@ return this;

@@ -30,2 +30,3 @@ /*!

this.socket = socket;
this._reject = null;

@@ -37,2 +38,10 @@ this.socket.on('close', () => {

this.socket.on('error', (err) => {
const reject = this._reject;
if (reject) {
this._reject = null;
reject(err);
return;
}
this.emit('error', err);

@@ -42,3 +51,3 @@ });

this.socket.on('listening', () => {
this.emit('listening');
this.emit('listening', this.address());
});

@@ -62,4 +71,15 @@

return new Promise((resolve, reject) => {
args.push(wrap(resolve, reject));
this.socket.bind(...args);
this._reject = reject;
args.push(() => {
this._reject = null;
resolve(this.address());
});
try {
this.socket.bind(...args);
} catch (e) {
this._reject = null;
reject(e);
}
});

@@ -70,3 +90,15 @@ }

return new Promise((resolve, reject) => {
this.socket.close(wrap(resolve, reject));
this._reject = reject;
const cb = () => {
this._reject = null;
resolve();
};
try {
this.socket.close(cb);
} catch (e) {
this._reject = null;
reject(e);
}
});

@@ -81,2 +113,4 @@ }

getRecvBufferSize() {
if (!this.socket.getRecvBufferSize)
return 512;
return this.socket.getRecvBufferSize();

@@ -86,5 +120,11 @@ }

getSendBufferSize() {
if (!this.socket.getSendBufferSize)
return 512;
return this.socket.getSendBufferSize();
}
hasBufferSize() {
return typeof this.socket.setRecvBufferSize === 'function';
}
ref() {

@@ -112,3 +152,4 @@ this.socket.ref();

setMulticastInterface(iface) {
this.socket.setMulticastInterface(iface);
if (this.socket.setMulticastInterface)
this.socket.setMulticastInterface(iface);
return this;

@@ -128,3 +169,4 @@ }

setRecvBufferSize(size) {
this.socket.setRecvBufferSize(size);
if (this.socket.setRecvBufferSize)
this.socket.setRecvBufferSize(size);
return this;

@@ -134,3 +176,4 @@ }

setSendBufferSize(size) {
this.socket.setSendBufferSize(size);
if (this.socket.setSendBufferSize)
this.socket.setSendBufferSize(size);
return this;

@@ -167,15 +210,1 @@ }

};
/*
* Helpers
*/
function wrap(resolve, reject) {
return function(err, result) {
if (err) {
reject(err);
return;
}
resolve(result);
};
}
{
"name": "budp",
"version": "0.1.3",
"version": "0.1.4",
"description": "UDP wrapper for node.js",

@@ -22,3 +22,3 @@ "keywords": [

"devDependencies": {
"bmocha": "^0.1.0"
"bmocha": "^1.0.0"
},

@@ -25,0 +25,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc