added global firebase context settings

This commit is contained in:
Peter Svensson
2019-07-02 19:45:37 +02:00
parent 077199e320
commit ae90a7c225
4 changed files with 18 additions and 22 deletions

View File

@ -26,29 +26,14 @@ module.exports = function(RED) {
let path = msg.payload.path || this.path
let bucket = msg.payload.bucket || this.bucket
console.log('storage-read reading from bucket "'+bucket+'" path "'+path+'"')
this.storage.getBuckets().then((results)=>{
const [buckets] = results;
console.log('Buckets:');
buckets.forEach(bucket => {
console.log(bucket.name);
});
this.storage
.bucket(bucket)
.file(path).download().then((file)=>{
console.log('storage-read got file')
//console.dir(file)
node.send({payload:file})
})
this.storage
.bucket(bucket)
.file(path).download().then((file)=>{
console.log('storage-read got file')
//console.dir(file)
node.send({payload:file})
})
}
}.bind(this));