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

mongofileupload

v1.0.1

Published

This is npm package to easily upload files to mongoDB

Readme

MongoFileUpload

MongoFileUpload is a simple npm package to upload files to mongodb. It simply stores the file chunk to MongoDB as a document. It can be used for the profile and simple document upload. As we can store max 16MB data to a document so we cannot store more then that in one document. It can be used to store files with other text fields in the same document.

  • Creates an object for a file with the details like name,extension,content and size
  • Can be saved multiple files at a time but the sum of sizes of all files and fields, should be less then 16MB
  • It uses promises to handle the response

Features!

  • Easy to use
  • Can upload multiple files

Installation

Install the dependencies and devDependencies and start the server.

$ npm i mongofileupload

How to use

  1. Connect to Mongodb collection
const {fileDetails,mongoUploadOne,mongoRetreive}  = require('mongofileupload');
const MongoClient = require('mongodb').MongoClient

const connectionString = MONGO_URI;
MongoClient.connect(connectionString, { useUnifiedTopology: true })
const Collection = client.db('test').collection('test')
  1. Create a object/document to store in collection
  var documentToSave = {};
  documentToSave.name = "abc";
  documentToSave.profile = new fileDetails('prof.png','./profile.png');
  documentToSave.resume = new fileDetails('res.pdf','./resume.pdf');
  documentToSave.email = "[email protected]";
  
  //save the document 
  mongoUploadOne(Collection,documentToSave).then((result)=>{
    console.log(result);
  })
  .catch((err)=>{
    console.log(err);
  });
  1. To retreive
  mongoRetreive(Collection).then((result)=>{
        //to save a file 
      fs.writeFile('/home/coder/Music/'+result[0].resume.filename,result[0].resume.content, "binary", function(err) {
        if(err) {
            return console.log(err);
        }
        else console.log("The file was saved!");
      });

How to contribute

Want to contribute? Great!

  1. Give it a star if you like it
  2. fork the repo
  3. clone it
$ git clone https://github.com/Rajpra786/MongoFileUpload.git
$ cd MongoFileUpload
  1. create new branch
$ git checkout -b branch_name
  1. edit files
  2. update files in new branch
$ git add -A
  1. commit
$ git commit -m "info about your edits"
  1. push it
$ git push --set-upstream origin new-branch
  1. Now from github web site, make a pull request for more details about how to create a pull request check it here

You can do following upgrades to this project

  • Add an example(like a profile page which requires image as well as other detials)
  • Remove the limitation of 16MB by saving the remaining file chuncks to another document
  • Your own ideas

License

MIT