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

@dev-codergautam/drag-and-drop-uploader

v1.0.0

Published

A lightweight drag-and-drop file uploader with previews.

Downloads

15

Readme

A good README.md is the "front door" of your project. It needs to tell developers exactly what the package does, how to install it, and—most importantly—how to get it running in 60 seconds.

Here is a professional, well-structured README.md tailored for your @dev-codergautam/drag-dropuploader package.


@dev-codergautam/drag-dropuploader

A lightweight, zero-dependency Vanilla JavaScript library for creating beautiful drag-and-drop file upload zones with real-time image previews.

🚀 Features

  • Drag & Drop Support: Seamlessly handle file drops.
  • Clipboard Integration: Supports pasting images directly from the clipboard.
  • Live Previews: Automatically generates and displays thumbnails for images.
  • State Management: Easily retrieve the current list of files for form submission.
  • Customizable: Filter by file types and hook into update events.

📦 Installation

Install the package via NPM:

npm install @dev-codergautam/drag-dropuploader

🛠 Usage

1. Vanilla JavaScript

First, create a container in your HTML:

<div id="my-uploader"></div>

Then, initialize the uploader in your JavaScript file:

import SimpleUploader from '@dev-codergautam/drag-dropuploader';
import '@dev-codergautam/drag-dropuploader/src/styles.css';

const uploader = new SimpleUploader('#my-uploader', {
  allowedTypes: ['image/jpeg', 'image/png'],
  onFilesUpdate: (files) => {
    console.log("Files updated:", files);
  }
});

// To get the files when submitting a form:
const files = uploader.getFiles();

2. React (Vite) Implementation

Since this is a DOM-based library, use the useEffect hook to initialize it.

import { useEffect } from 'react';
import SimpleUploader from '@dev-codergautam/drag-dropuploader';
import '@dev-codergautam/drag-dropuploader/src/styles.css';

export default function UploaderComponent() {
  useEffect(() => {
    const uploader = new SimpleUploader('#uploader-container', {
      onFilesUpdate: (files) => console.log(files)
    });
  }, []);

  return <div id="uploader-container"></div>;
}

⚙️ Configuration Options

| Option | Type | Default | Description | | --- | --- | --- | --- | | allowedTypes | Array | ['image/'] | Array of MIME types or prefixes to allow. | | onFilesUpdate | Function | null | Callback function triggered whenever files are added or removed. |


📖 API Methods

| Method | Description | | --- | --- | | .getFiles() | Returns an Array of the currently selected File objects. | | .removeFile(file) | Removes a specific file object from the internal state and updates the UI. |


🎨 Custom Styling

The package comes with default styles, but you can override them in your own CSS. Key classes include:

  • .upload-container: The main dropzone area.
  • .drag-over: Applied to the container when a file is being hovered over it.
  • .image-preview-wrapper: The wrapper for each individual image thumbnail.
  • .remove-icon: The "X" button used to delete a preview.

📄 License

MIT © dev-codergautam


Pro-Tip for your GitHub:

Include a GIF or a screenshot at the top of the README! Developers love seeing the UI in action before they install a package.

Would you like me to help you write a .gitignore file so you don't accidentally upload your node_modules to GitHub?