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

tohiver

v2.0.0

Published

Move prefixed files to archive hierarchy

Downloads

7

Readme

tohiver

Speed up your file organising. Get a service to your macOs context menu that moves the selected files based on few simple rules. For example you can do the following after installation: right-click a directory 2017-12-25-christmas-photos in Finder and choose Move to Archive. The directory will be moved under /Users/yourname/some/dir/2017 and a notification about the success will be displayed. Your Christmas photos are now available at /Users/yourname/some/dir/2017/2017-12-25-christmas-photos.

Features:

  • Move files and directories that are prefixed with a 4-digit year to year-based directories.
  • Move files and directories whose name contain a keyword to a given directory.

Personally I use this to archive files into Dropbox systematically.

Install

First, ensure you have Node.js installed:

$ node --version
v7.1.0
$ npm --version
3.10.9

Second, install tohiver globally:

$ npm install tohiver -g

Third, find absolute paths to node and tohiver. We need these paths soon.

$ which node
/usr/local/bin/node
$ which tohiver
/usr/local/bin/tohiver

Fourth, create an Automator workflow by following these steps:

  • open Automator. It is installed by default in macOS.
  • In Automator, select from menu: File > New
  • Choose a type for your document: Service
  • Choose "Service receives selected files and folders in Finder.app"
  • Drag Run Shell Script action to the workflow
  • In the action, choose "Shell: /bin/bash" and "Pass input: to stdin"

Now, recall the absolute paths from the third step because Run Shell Script understands only absolute paths. Write a line into the Run Shell Script action, similar to:

/usr/local/bin/node /usr/local/bin/tohiver --yyyy /Users/yourname/some/dir

This is enough to do the job. However, it is nice to have a notification about success or possible errors. To display a notification, drag a Run JavaScript action to the workflow and copy in the following code:

function run(input, parameters) {
  var app = Application.currentApplication()

  app.includeStandardAdditions = true

  var soundName = 'Ping'
  if (input[0].substr(0,5).toLowerCase() === 'error') {
    soundName = 'Basso'
  }

  app.displayNotification(input[0], {
    withTitle: 'Move to Archive',
    soundName: soundName
  })
}

The code basically displays the first line of tohiver's output. It also detects an error message and chooses a suitable notification sound. If you like to customize, list available sounds by $ ls /System/Library/Sounds.

Finally, choose a name for your workflow (e.g. Move to Archive) and then File > Save. Now, when you right-click a file or directory in Finder, you should notice a new service among the last items of the context menu.

Command Line Interface

tohiver --yyyy <dirpath> --tagged <dirpath> --tagged <dirpath>

Development

Use npm link to install the module CLI globally. Test manually by running tohiver, then feed input and close with ctrl-d.

Licence

MIT