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

virtual-file

v0.1.0

Published

[![NPM version][npm-image]][npm-url] [![Build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] [![Dependency Status][david-image]][david-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][dow

Readme

virtual-file

NPM version Build status Test coverage Dependency Status License Downloads Gittip

A virtual file abstraction for. This is meant to be used as the file abstraction for normalize.

Goals:

  • Caching ideal for long running processes
  • Easily file transformations, including intermediary files
  • Seamless source map support
  • Suitable for production usage

Current limitations:

  • Files are considered to be on-disk. However, inline files (i.e. inlined <script>s) are currently not supported. Need to figure out a mechanism for those types of files.

API

var file = new File(uri)

Creates a new file abstraction based on a URI. A URI could have #s or ?s. However, the file must be a local file. If it's a remote file, download it first.

Properties

  • .filename - the filename of the file. Unlike the URI, this property is dynamic and removes any #s and ?s in the name.
  • .dirname - the folder this file is located.
  • .basename - the basename of this file. This property is dynamic, meaning you can set it, and the filename will be updated automatically.
  • .type - the current mime type of the file. Set the current mime type of the file to keep track of the current transformations.
  • .exists - whether the file exists, defaulting to true.
  • .sourcemap - whether source maps are enabled, defaulting to true.
  • .static - whether this file changes over time (i.e. for a watching instance), defaulting to false. Set this to true in production when you know files aren't going to change.

file.stat().then( => )

Check fs.stat() the file and get the sha256 sum of the file. Adds the following properties:

  • .length - the byte length of the file
  • .mtime - the modified time of the file as a Date.
  • .hash - the sha256 sum of the file as a Buffer.

You should run this before running anything else.

file.getString().then( string => )

Get the current contents of the file as a string. Also sets it as .string. If the string contains an inline source map, it will be removed and moved to .map.

file.string=

Set a string as the current contents of the file after a transformation. If the string contains an inline source map, it will be removed and moved to .map.

file.map

Get the current source map of the file, if any.

file.map=

Set the source map of the file. This should be set before file.string=. If a previous source map exists, it will be applied to the newest source map. Otherwise, the current string and .basename will be set as the source.

file.isStale().then( stale => )

Check whether the file is stale. If it is stale, then a new file object will be returned. Being using the new file object instead of this one. The file is stale if any of the following is true:

  • The file previously did not exist, but now does.
  • The file's length has changed.
  • The file's mtime has changed.
  • The sha256 sum of the file has changed.