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

media-archiver

v1.2.0

Published

Archiver for media files imported from mobile devices

Downloads

461

Readme

media-archiver

Archive media files from a source directory to a structured destination following a YYYY/MM/DD/<import-letter>/ pattern.

Install

npm install -g media-archiver

Usage

media-archiver --source <dir> --target <dir> [options]

Options

| Option | Alias | Required | Default | Description | |--------|-------|----------|---------|-------------| | --source | -s | Yes | — | Source directory to scan | | --target | -t | Yes | — | Target directory where files are archived | | --mode | -m | No | copy | Operation mode: copy, move, or date | | --dry-run | — | No | false | Preview operations without writing any files | | --recurse | -r | No | false | Scan subdirectories of --source recursively | | --verbose | -v | No | false | Print detailed logs for every file operation | | --help | -h | No | — | Display help message |

Modes

  • copy — Copy source files to the target directory
  • move — Move source files to the target directory
  • date — Fix atime and mtime of existing files in the target directory (useful after a manual move)

Output

Without --verbose, a progress bar is shown during processing, followed by a summary of destination folders written:

Source:  /Volumes/CARD/DCIM
Target:  ~/Media
Mode:    copy
Recurse: false
3 file operation(s) to process

Folders written (2):
  ~/Media/Photos/2025/08/28/a
  ~/Media/Videos/2025/09/16/a

Done

With --verbose, every file operation is logged individually with timestamps and log levels.

Examples

# Copy photos and videos from a memory card, dry-run first
media-archiver --source /Volumes/CARD/DCIM --target ~/Media --dry-run

# Then for real
media-archiver --source /Volumes/CARD/DCIM --target ~/Media

# Move files recursively with detailed logs
media-archiver -s /Volumes/CARD -t ~/Media -m move -r --verbose

Destination structure

Files are organised by date and import batch:

~/Media/
├── Photos/
│   └── 2026/
│       └── 04/
│           └── 05/
│               ├── a/          ← first import of the day
│               │   ├── IMG_001.jpg
│               │   └── IMG_002.jpg
│               └── b/          ← second import of the day (different source)
│                   └── IMG_003.jpg
└── Videos/
    └── 2026/
        └── 04/
            └── 05/
                └── a/
                    └── VID_001.mp4

The letter (a, b, c...) increments automatically with each new import run targeting the same date folder, allowing files from different sources to be kept separate.

Configuration

The configuration file must be located at ~/.config/media-archiver/config.yaml.

media:
  mode: copy          # Default mode (overridden by --mode)
  dryRun: false       # Default dry-run flag (overridden by --dry-run)
  types:
    - name: photos
      directory: Photos
      extensions:
        - jpg
        - jpeg
        - png
        - heic
    - name: videos
      directory: Videos
      extensions:
        - mp4
        - mov
        - avi

Configuration fields

| Field | Required | Description | |-------|----------|-------------| | media.types | Yes | List of media type definitions | | media.types[].name | Yes | Identifier for the type (informational) | | media.types[].directory | Yes | Subdirectory under --target for this type | | media.types[].extensions | Yes | File extensions to match (case-insensitive, without leading dot) | | media.mode | No | Default mode when --mode is not provided | | media.dryRun | No | Default dry-run when --dry-run is not provided |

Files whose extension is not matched by any type are silently skipped.

Development

npm install
npm run build          # Compile TypeScript
npm test               # Run unit tests
npm run test:e2e       # Run end-to-end tests
npm run test:all       # Run all tests
npm run test:coverage  # Run tests with coverage report
npm run lint           # Check code style
npm run lint:fix       # Auto-fix code style issues

License

MIT