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

@sjaakp/stylefile

v0.9.1

Published

jQuery widget to style HTML File Input

Downloads

18

Readme

jQuery Stylefile

File input HTML controls are notorious because they are almost impossible to style by means of CSS. Each browser implements the file input in it's own way.

Stylefile is a jQuery widget that takes over the HTML file input control and allows it to be styled like the rest of the page. In addition, it gives the user more feedback on the selected file.

Dependencies

Stylefile is a simple jQuery control. It's only dependency is jQuery.

Usage

Load resources

At the end of the body part, load the jQuery library:

<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>

And the Stylefile code:

<script src="jquery.stylefile.js"></script>

Set-up

Stylefile is initialised like:

$(<selector>).stylefile(<options>);

Preferably, this is done in the document.ready handler, like:

<script>
    $(document).ready(function () {
        $("#fileInput").stylefile({
            ... Stylefile options ...
        });
    });
</script>

To select all file inputs on a page, use something like:

<script>
    $(document).ready(function () {
        $("[type=file]").stylefile({
			btnText: "Choose image to upload...",
            ... other Stylefile options ...
        });
    });
</script>

Options

btnClass

The classname(s) of the 'Browse' button. Default is: "btn btn-default" (consistent with Bootstrap CSS).

btnText

Text of the 'Browse' button. Default: "Browse".

decimals

Number of decimals in the 'nice_nbytes' presentation of the filesize. Default: 3.

infoClass

The classname(s) of the informative text. Default is "text-muted", another Bootstrap classname.

infoTemplate

Template for the informative text. It is a fragment of HTML, in which the following subtexts are replaced by information about the selected file:

  • {filename} the name of the selected file
  • {imgsize} the image size, in pixels (w x h)
  • {nbytes} the file size in bytes
  • {nice_nbytes} the file size in a more readable format.

Default: '{filename}&emsp;<span class="imgsize">{imgsize}</span><br /><span class="filesize">{nice_nbytes} ({nbytes} bytes)</span>'