npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

upload-json-mock-firebase

v2.0.0

Published

Upload json files or data mocks to firebase - Sube archivos json o mocks de datos a firebase

Readme

Upload Json/Mock Firebase

This package allows you to upload and update data to Firebase using the Firebase SDK for JavaScript.

Installation

You can install the package using npm:

npm install upload-json-mock-firebase

Usage

This package is compatible with both CommonJS (require) and ES modules (import). You can use it in your code like this:

// using CommonJS
const initializeFirebase = require("upload-json-mock-firebase");

//or

// using ES modules
import initializeFirebase from "upload-json-mock-firebase";

Uploading Data

To upload data to Firebase, you can use the upload method of the FirebaseUpload class.

const initializeFirebase = require("upload-json-mock-firebase");

// Firebase configuration
//This configuration is extracted from the SDK of your Firebase project.
const firebaseConfig = {
  apiKey: "your-api-key",
  authDomain: "your-auth-domain",
  projectId: "your-project-id",
  storageBucket: "your-storage-bucket",
  messagingSenderId: "your-message-sender-id",
  appId: "your-app-id",
};

// Data to upload
//The "data" variable can be a mock of data or an imported JSON file.
const data = [
  {
    name: "John Doe",
    email: "[email protected]",
    age: 30,
  },
  {
    name: "Jane Smith",
    email: "[email protected]",
    age: 25,
  },
];

// Collection name
const collection = "users";

// Initialize FirebaseUpload
const firebaseUpload = initializeFirebase(firebaseConfig, data, collection);

// Upload data
firebaseUpload
  .upload()
  .then((response) => console.log(response))
  .catch((error) => console.error(error));

Updating Data

To update data in Firebase, you can use the update method of the FirebaseUpload class.

const initializeFirebase = require("upload-json-mock-firebase");

// Firebase configuration
//This configuration is extracted from the SDK of your Firebase project.
const firebaseConfig = {
  apiKey: "your-api-key",
  authDomain: "your-auth-domain",
  projectId: "your-project-id",
  storageBucket: "your-storage-bucket",
  messagingSenderId: "your-message-sender-id",
  appId: "your-app-id",
};

// Data to update
//The "data" variable can be a mock of data or an imported JSON file.
const data = [
  {
    name: "John Doe",
    email: "[email protected]",
    age: 31,
  },
  {
    name: "Jane Smith",
    email: "[email protected]",
    age: 26,
  },
  {
    name: "Bob Johnson",
    email: "[email protected]",
    age: 40,
  },
];

// Collection name
const collection = "users";

// Initialize FirebaseUpload
const firebaseUpload = initializeFirebase(firebaseConfig, data, collection);

// Field to filter by
//In this case, this filter ensures that emails that already exist in the database are not uploaded again.
const filter = "email";

// Update data
firebaseUpload
  .update(filter)
  .then((response) => console.log(response))
  .catch((error) => console.error(error));

API

initializeFirebase(firebaseConfig, data, collection)

This function returns an instance of the FirebaseUpload class, which you can use to upload or update data to Firebase.

  • firebaseConfig: Firebase configuration object.
  • data: Array of data to upload or update.
  • collection: Name of the collection where the data will be stored.

FirebaseUpload

This class allows you to upload and update data to Firebase.

constructor(firebaseConfig, data, collection)

This method creates an instance of the FirebaseUpload class.

  • firebaseConfig: Firebase configuration object.
  • data: Array of data to upload or update.
  • collection: Name of the collection where the data will be stored.

upload()

This method uploads data to Firebase.

update(filter)

This method updates data in Firebase.

  • filter: Field in the collection to filter by.

Author

This project was developed by Copilot Dev. If you have any questions or comments, please feel free to contact me via email at send email.

License

This package is released under the MIT License.