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

collator

v0.0.2

Published

A NodeJS command line utility to collate files into user defined folders based on user defined regular expressions.

Downloads

4

Readme

collator

A NodeJS command line utility to collate files into user defined folders based on user defined regular expressions.

This utility can be configured to sort whatever files into whichever folders you want. For instance, a use case that drove its development was when one downloads videos whether it be through torrents, NZBs, or direct download sites, the desired file is usually nested within one or more folders. With many videos nested in folders, one's Downloads folder can become quite messy. In addition, if you wish to move only the videos to a separate backup you'd have to drill down into each folder and pull out the videos. This tedious process can be avoided using this tool.

To accommodate various requirements when collating files, whether it be a form of filename or file extension this utility allows for filtering based on regular expressions.

##Getting Started

  1. Install the utility
$ npm install collator -g

This will install the utility in the global namespace for you to use in any directory.

  1. Setup configuration The utility has a default configuration however you'll probably want to configure your own. The below will initialize a configuration file in current directory:
$ collator -i -p .

Here is an example of a configuration file:

{
  "ROOT_SEARCH_DIR":".",
  "DESTINATION_DIRS": {
    "dest": "./completed",
    "trash": "./trash"
  },
  "PATH_EXCLUSIONS": [
    "./incomplete",
    "./NZBs"
  ],
  "FILTERS": {
    "dest": "^(?!.*sample)(.*\\.((mkv|avi|mp4|mpeg|mpg|mov)$))[^.]*$",
    "trash": "*"
  },
  "VIDEORENAME": true
}
  1. Run the utility
$ collator

This will run the utility and begin recursively filtering files starting at the ROOT_SEARCH_DIR.

##Options | Name | Description | | ---- | ----------- | | -i, --initconfig | Initialize a custom configuration file | | -p, --filepath [value] | Optional filepath modifier to specify where the newly created custom configuration file will be placed | | -c, --collatepath [value] | Optional override that will specify the path to begin recursive collation. Overrides ROOT_SEARCH_DIR. | | -h, --help | Output usage information | | -V, --version | Output the version number |

##Configuration Parameters | Name | Example | Description | | ---- | ------- | ----------- | | ROOT_SEARCH_DIR | ./root` | A root filepath where recursive collation will begin. | | DESTINATION_DIRS | `{"dest": "./completed"} | Key-value pairs specifying a particular destination filepath for a collated file. Keys must map to a corresponding regular expression mapped in FILTERS. | | FILTERS | {"dest": "^(?!.sample)(..((mkv|avi|mp4|mpeg|mpg|mov)$))[^.]*$"} | Key-value pairs specifying regular expressions to match files. Note that a * value is used to denote a key that will correspond to a key-value pair in DESTINATION_DIRS used to throw files that do not match to any other defined regular expression. | | PATH_EXCLUSIONS | ["./incomplete",] | An array of directory filepaths to ignore while recursively collating | | VIDEORENAME | true | A boolean flag to enable the renaming of files that match a regular expression but have no TV season episode format ie. s01e02 and does not contain the first 5 characters of its parent folder name. This is for a specific usecase and will be later genericized. |