Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
upnp-device
Advanced tools
upnp-device lets you create UPnP Devices in Node.js. The goal is to have an easy to use API, rather than exposing all UPnP internals.
npm install upnp-device
In case you want to use the built in media server you also need to install Redis, preferrably using your system package manager.
var upnp = require('upnp-device');
var mediaServer = upnp.createDevice('MediaServer', 'My Media Application');
mediaServer.on('ready', function() {
mediaServer.addMedia(0, media, function(err, id) {
console.log("Added new media with ID:" + id);
});
mediaServer.announce();
});
For a real world usage example, look at Bragi, a media server using node-upnp-device.
function() { }
Emitted when the server has been assigned an IP, the HTTP server has started and SSDP messaging has been initialized.
function(err) { }
Create an instance of your own device implementation. Check the examples on how to create your own devices and services.
var myDevice = require('./MyDevice')
var device = upnp.createMyOwnDevice(myDevice, 'My Device');
device.on('ready', function() {
device.ssdpAnnounce();
});
Applies to MediaServer.
The metadata needs to be extracted by the client, either through user input or by reading for example ID3 tags.
container = {
'class': 'object.container.album.musicAlbum',
'title': 'My album'
};
item = {
'class': 'object.container.audioItem.musicTrack',
'title': 'My song',
'creator': 'An artist',
'location': '/media/mp3/an_artist-my_song.mp3',
'album': 'My album'
};
Other official UPnP classes and properties are defined in the MediaServer specification.
The server only stores the media info for as long as it is running. It is the responsibility of the client to store media information across restarts if desired.
upnp-device is written in CoffeeScript.
Contributions and comments are welcome on GitHub or IRC (jacobrask@FreeNode).
FAQs
Create UPnP devices in Node.js
The npm package upnp-device receives a total of 2 weekly downloads. As such, upnp-device popularity was classified as not popular.
We found that upnp-device demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.