Using node.js with the npm firebase.
var firebase = require('firebase'); var blahFirebase = new firebase('https://myfirebase.firebaseIO.com/blah'); blahFirebase.once('value', function (snapshot) { // });
Why does node not exit when it is done reading the data?
In the new Firebase API you should use firebase.app.App.delete() to free the resources its holding. For example:
var app = firebase.initializeApp({ ... }); var db = firebase.database(); // Do something app.delete(); // Release resources
Do not use process.exit()
since it will stop the entire process (which is not what you would usually want).
My case is using firebase admin,
const admin = require('firebase-admin');
and I can end node process by
return admin.app().delete();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With