Dia antes primera install
This commit is contained in:
7
node_modules/node-red-contrib-excel/LICENSE
generated
vendored
Normal file
7
node_modules/node-red-contrib-excel/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright 2017 Dixyantar Panda
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
8
node_modules/node-red-contrib-excel/README.md
generated
vendored
Normal file
8
node_modules/node-red-contrib-excel/README.md
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
##Excel Converter node
|
||||
######This node converts input json (msg.payload) into excel format and writes to a local file.
|
||||
#######Path of the input need to be specified
|
||||
#######Output is the filepath in msg.attachment, msg.filename, msg.file.
|
||||
Return all other msg properties intact
|
||||
|
||||
**Developed by Dixyantar Panda**
|
||||
Credits to original package owner of json2xls
|
||||
38
node_modules/node-red-contrib-excel/excel/excel.html
generated
vendored
Normal file
38
node_modules/node-red-contrib-excel/excel/excel.html
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('excel',{
|
||||
category: 'function',
|
||||
color: '#6B8E23',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
file: {value:""}
|
||||
},
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
icon: "file.png",
|
||||
align: 'right',
|
||||
paletteLabel:"excel",
|
||||
label: function() {
|
||||
return this.name||"excel";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-template-name="excel">
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-input-file"><i class="icon-tag"></i> File *</label>
|
||||
<input type="text" id="node-input-file" placeholder="/home/app/output.xlsx">
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="excel">
|
||||
<p>Converts a JSON or array of JSONs to excel and writes to the file specified</p>
|
||||
<p>Expects the JSON to be msg.payload</p>
|
||||
<p>File path can be configured on node or set as msg.filepath </p>
|
||||
</script>
|
||||
36
node_modules/node-red-contrib-excel/excel/excel.js
generated
vendored
Normal file
36
node_modules/node-red-contrib-excel/excel/excel.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
module.exports = function (RED) {
|
||||
"use strict";
|
||||
var json2xls = require('json2xls');
|
||||
var fs = require('fs');
|
||||
|
||||
function ConvertJSONToExcel(config) {
|
||||
RED.nodes.createNode(this, config);
|
||||
this.file = config.file;
|
||||
this.on('input', function(msg){
|
||||
var node = this;
|
||||
var file = msg.filepath;
|
||||
if(file === undefined || file === null){
|
||||
if(node.file === undefined || node.file === null ){
|
||||
console.log("File path cannot be null");
|
||||
node.error("filepath cannot be null");
|
||||
}else{
|
||||
file = node.file;
|
||||
}
|
||||
}
|
||||
if(msg.payload === undefined || msg.payload === null){
|
||||
console.log("Payload cannot be blank");
|
||||
node.error("payload cannot be null");
|
||||
}else{
|
||||
var xls = json2xls(msg.payload);
|
||||
fs.writeFileSync(file, xls, 'binary');
|
||||
msg.attachment=file;
|
||||
msg.filename=file;
|
||||
msg.file=file;
|
||||
node.send(msg);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
RED.nodes.registerType("excel", ConvertJSONToExcel);
|
||||
}
|
||||
15
node_modules/node-red-contrib-excel/package.json
generated
vendored
Normal file
15
node_modules/node-red-contrib-excel/package.json
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name" : "node-red-contrib-excel",
|
||||
"version" : "0.0.3",
|
||||
"description" : "Converts JSON to excel and writes to file specified.",
|
||||
"dependencies": {
|
||||
"json2xls" : "0.1.2"
|
||||
},
|
||||
"keywords": [ "node-red" ,"Excel", "JSON to Excel", "node-red-excel", "xlsx", "xls"],
|
||||
"node-red" : {
|
||||
"nodes": {
|
||||
"xlsx": "excel/excel.js"
|
||||
}
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
Reference in New Issue
Block a user