node-lox-ws-api
Version:
Web Socket Loxone™ API
20 lines (16 loc) • 450 B
JavaScript
var File = function (message, filename) {
this.filename = filename;
if (message.type !== 'binary'){
if (filename.match(/\.json$/)) {
this.type = 'json';
this.data = JSON.parse(message.utf8Data);
}else{
this.type = 'text';
this.data = message.utf8Data;
}
}else{
this.type = 'binary';
this.data = message.binaryData;
}
};
module.exports = File;