diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..251c64e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs +# editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 2 + +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/src/actions/play.js b/src/actions/play.js index 799d368..4e4b824 100644 --- a/src/actions/play.js +++ b/src/actions/play.js @@ -1,4 +1,3 @@ -import fs from 'fs'; import _ from 'lodash'; import logger from '../logger'; import config from '../config'; @@ -31,23 +30,7 @@ const playCommand = () => new Promise((resolve, reject) => { deviceItem.sendData(buffer, false); }); resolve(data); - }); - /* - fs.readFile(data.filePath, 'utf8', (err, fileData) => { - if (err) { - return reject(new Error(`Failed to find file: ${data.filePath}`)); - } - _.each(data.deviceModules, (deviceItem) => { - logger.info( - `Send command topic: ${data.topic}, message: ${data.message}, file: ${data.path}/${data.message}, device: ${deviceItem.mac}`, - ); - const buff = new Buffer(fileData, 'base64'); - console.log('send', fileData, buff); - deviceItem.sendData(buff, false); - }); - resolve(data); - }); - */ + }).catch(reject); } });