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 🙏

© 2024 – Pkg Stats / Ryan Hefner

rotty

v1.0.3

Published

Discovers bit-rot in files

Downloads

12

Readme

rotty

Rotty is a tool to discover bit-rot in files-at-rest. It works similar to the "scrub" functionality in ZFS and BTRFS filesystems. It verifies file data against previously stored checksums.

Why?

Silent data corruption is pretty common. However, various error correction mechanisms inside storage drives are able to correct it. Sadly, they only kick in when data is retrieved. There is no periodic or continous proactive data checking. Sometimes the data correction mechanism is not even able to fix the data.

This application is supposed to be run periodically. All it does is reading the files and calculating SHA1 hash of the contents. Technically it would be sufficient to just read the files as reading would trigger potential hardware errors.

Warning!

This application only checks for file corruption. It is not able to repair the files. You need actual backups to replace the corrupted files!

Modified files based on file modification timestamp are skipped.

Use cases

This tool is suitable for small dataset of couple of TB in size. The verification operation is assumed to run completely at once and is not resumable. There is no rate-limiting built-in. The dataset size is limited by acceptable running time and the underlying hardware bandwidth.

Alternatives

  • File system with built-in "scrub" feature: ZFS, BTRFS or ReFS.
  • Similar scripts found elsewhere on the Internet.
  • File versioning system such as git-annex or git-lfs.

Installation

You need to have Node.js version 18+ installed. To install rotty:

npm install -g rotty

Setup

Initialize the checksums file for the directory:

rotty <directory> --init

The configuration file is stored in <directory>/.checksums/config.json. The file contains:

{
  "skip": ["some-file.txt"],
  "skipDotfiles": true
}
  • Property skip: array of skipped filenames to match in directories.
  • Property skipDotfiles: whether to skip filenames starting with dot (.).

Usage

Running rotty <directory> will run verification against files that are in the latest database and will add new files into the database.

All modified files (based on modification time) will be reported. Files that are not modified but have different checksum will also be reported.

If there are non-modified files with different checksum than previously then the program will exit with status code 1.

Database

The checksums data is stored in <directory>/.checksums directory. The application creates file checksums-<timestamp>.json containing checksums as a JSON array.

Example database:

[
  {
    "path": "hello.txt",
    "sha1": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "mtimeMs": 1688067363987.008
  }
]

License

The MIT License. See the LICENSE file.