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

search-filenames

v0.1.1

Published

It works similarly to `find` command found on some systems but with less options and potentially more speed. I've seen some other utilities doing this but this is pretty good and the source should be easy to understand if you decide to look at it.

Downloads

6

Readme

search-filenames

It works similarly to find command found on some systems but with less options and potentially more speed. I've seen some other utilities doing this but this is pretty good and the source should be easy to understand if you decide to look at it.

There's no short version to any of the CLI options. If there's interest for that we can talk about it.

Table of Contents

Install

For using the JS API:

npm install search-filenames

Using globally with CLI:

npm install --global search-filenames

Alias

If you want to use a shorter version I recommend creating an alias in your shell files.

alias inhere="search-filenames --root-path $PWD --exclude node_modules --exclude .git --include"

inhere "cli.js"

CLI

search-filenames --root-path ~ --exclude node_modules --exclude .git --include-glob '*.sublime-workspace' --concurrency=16

| Option | one or many | Description | | ------------------- | ----------- | ------------------------------------------------------------------- | | --root-path | one | Where to begin searching | | --include | many | The filename includes the text exactly | | --include-glob | many | The filename matches the glob pattern | | --include-regexp | many | The filename matches the JavaScript RegExp pattern | | --exclude | many | The filename does not include the text exactly | | --exclude-glob | many | The filename does not match the glob pattern | | --exclude-regexp | many | The filename does not match the JavaScript RegExp pattern | | --follow-symlinks | one | Search inside where the symlink directory goes. Defaults to false | | --concurrency | one | How many I/O operations can it initiate at a time? Defaults to 8 | | --stat-type | many | Only include these stat types in the output |

Stat types correspond to what information we can get from the node fs fs.stat and fs.lstat functions.

  • character-device --stat-type character-device
  • directory --stat-type directory
  • fifo --stat-type fifo
  • file --stat-type file
  • symlink --stat-type symlink
  • socket --stat-type socket

JS API

const searchFilenames = require("search-filenames");

const searchOpts = {
  concurrency: 6,
  rootPath: "/Users/tcrowe/projects",
  includeGlobs: ["*.sublime-workspace"],
  exclude: ["node_modules", ".git"]
};

const searcher = searchFilenames(searchOpts);

searcher.on("error", err => console.error("searcher error", err));
searcher.on("file", res => console.log("file", res));

searcher.start();

Events

  • any ➡️ ({ statType:string, absolutePath:string }) any files matched the conditions
  • block-device ➡️ (absolutePath:string)
  • character-device ➡️ (absolutePath:string)
  • fifo ➡️ (absolutePath:string)
  • socket ➡️ (absolutePath:string)
  • symlink ➡️ (absolutePath:string)
  • directory ➡️ (absolutePath:string)
  • file ➡️ (absolutePath:string)
  • error ➡️ (Error)
  • end

Development

The development tasks run under npm run dev

Copying, license, and contributing

Copyright (C) Tony Crowe 2020 https://tcrowe.github.io/contact/

Thank you for using and contributing to make search-filenames better.

⚠️ Please run npm run prd before submitting a patch.

⚖️ search-filenames is Free Software protected by the GPL 3.0 license. See ./COPYING for more information. (free as in freedom)