Is there a way that I can read realtime database data from a running firebase emulator suite outside the firebase environment?

Viewed 39

I've been developing a solution to transform noSQL data to SQL on JavaScript. I've got a chunk of json data that I upload to the firebase emulator suite realtime database. How do I run the firebase emulator suite with the imported data and read the imported data from different node.js environment? (Do operations on a running emulator suite instance) Is that even possible?

I've tried with both packages - firebase, firebase-admin and I don't have the firebase project credentials.

Thanks in advance!

const { getDatabase, connectDatabaseEmulator, ref, onValue } = require("firebase/database");

const localConfig = {
  databaseURL: "http://localhost:9001?ns=dev-optishake",
};

const app = initializeApp(localConfig);

const db = getDatabase(app);
connectDatabaseEmulator(db, "localhost", 9001);

// const db = require("./optishake-backend-export.json");

async function runToSQL() {
  const machinesRef = ref(db, "users/");
  onValue(machinesRef, (snapshot) => {
    console.log(snapshot.val());
  });
}
runToSQL(); ```
0 Answers
Related