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

@mtillmann/file-ingest

v0.0.1

Published

simple file ingest for the browser

Downloads

17

Readme

File Ingest

A simple class to ingest files in the browser by drag and drop, copy and paste or file input.

Usage

Install the package:

npm install @mtillmann/file-ingest

After creating an instance, you'll receive a custom event file-ingest:files on the target element with the files as event.detail.files.

  • event.detail.files contains an array of files that passed the accept-option's MIME type check.
  • Set the includeRejectedFiles-option to true to include rejected files in event.detail.rejected.
  • If you set the emitWhenEmpty-option to true, the event will be emitted even when no matched files are present.

Bundler

import FileIngest from '@mtillmann/file-ingest';

const fileIngest = new FileIngest();

document.documentElement.addEventListener('file-ingest:files', (event) => {
  console.log(event.detail.files);
});

Module Script Tag

<script type="module">
  import FileIngest from '.../@mtillmann/file-ingest/dist/index.js';

  const fileIngest = new FileIngest();

  document.documentElement.addEventListener('file-ingest:files', (event) => {
    console.log(event.detail.files);
  });
</script>

Classic Script Tag

<script src=".../@mtillmann/file-ingest/dist/index.umd.js"></script>
<script>
  const fileIngest = new FileIngest();

  document.documentElement.addEventListener('file-ingest:files', (event) => {
    console.log(event.detail.files);
  });
</script>

Options

| Option | Type | Default | Description | | --- | --- | --- | --- | | target | String\|HTMLElement | document.documentElement | Element or Selector String to attach the events to | | accept | string | */* | List of MIME types that are accepted by the instance. Supports wildcard subtypes (e.g. image/*) | | paste | boolean | true | Enable or disable paste events | | drop | boolean | true | Enable or disable drop events | | change | boolean | true | Enable or disable change-events on [type=file]-inputs | | preventDefault | boolean | true | Prevent the default behavior of the events | | dragClasses | Record\<string, string \| string[]\> | ... | Classes to add and remove on drag events | | applyDragClasses | boolean | true | Apply drag classes to the target element | | ignorePasteOnInput | boolean | true | Ignore paste events on input, textarea and [contenteditable=true]-elements | | eventPrefix | string | file-ingest | Prefix for the custom events | | eventTarget | String\|HTMLElement | options.target | Element to dispatch the custom events on | | callback | Function | null | Callback function to call in addition to events - receives the content of event.detail as argument | | includeRejectedFiles | boolean | false | Include rejected files in the event detail - useful for error messages etc. | | emitWhenEmpty | boolean | false | Emit event even when no (matched) files are present |

API

destroy()

Removes all event listeners and cleans up the instance.