0

I use the following to code to get data from Firestore using node.js. I would like to keep the output of this query either in a permanent cache or local file system. I'm concern that we lose internet for extended period of time or if the system gets rebooted and doesn't have connection.

const serviceAccount = require('/serviceaccount.json');
fs.initializeApp({credential: fs.credential.cert(serviceAccount)});
const db = fs.firestore();

async function getPlaylist() {
const snapshot = await db.collection('signage-units').doc('a3b1c232').collection('playlists').get();
snapshot.forEach((doc) => {
console.log(/*doc.id, '=>',*/ doc.data());
displayPlaylist(doc.data().player,doc.data().interface,doc.data().path);
});
}```
nyitguy
  • 598
  • 4
  • 18
  • 1
    Does this answer your question? [Firestore offline data: Merging writes, maximum time of offline persistence](https://stackoverflow.com/questions/47111181/firestore-offline-data-merging-writes-maximum-time-of-offline-persistence) – Donnald Cucharo Feb 26 '21 at 06:39
  • I found an exact match to my question...https://stackoverflow.com/questions/56277906/is-firestore-a-good-choice-to-work-with-node-js-in-offline-mode – nyitguy Feb 26 '21 at 14:51

0 Answers0