Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var path = require('path'),
express = require('express'),
app = express(),
socketio = require('socket.io'),
easymidi = require('easymidi'),
deviceName = 'NodeJS MIDI out',
verbose = process.argv.indexOf("--verbose")>-1;
if (process.platform === "win32") {
// find the loopmidi 'NodeJS MIDI out' virtual port
var outputs = easymidi.getOutputs();
outputs.some(name => {
console.log(name, deviceName);
if (name.toLowerCase().indexOf(deviceName.toLowerCase()) > -1) {
out = new easymidi.Output(name);
return true;
}
return false;
});
} else {
out = new easymidi.Output(deviceName, true);
}
app.use(express.static(path.join(__dirname,'public')));
app.get('/socket.io.js', function(req, res) {
res.sendFile('socket.io.js', {
var easymidi = require('easymidi');
console.log('Input ports: \n\t'+easymidi.getInputs().join('\n\t'));
console.log('Output ports: \n\t'+easymidi.getOutputs().join('\n\t'));
process.exit(0);