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

go-find

v1.2.0

Published

Utility for doing a simple text search in files.

Downloads

5

Readme

Go-Find

Simple module for doing a basic text search in files on your file system. Upon calling the run() method it will output the list of file containing the matches on the search text into a specified file. Also here is the finder script that will call go-find with some prompts on the command line to do the text search for you.

It uses recursive-readdir module for searching so please refer to that for more information on how it's doing the search.

Uses the Javscript match() method to actually do the match on the text.

Useage

Quick Search: run npm start and follow the prompts.

Once you've entered all info at the prompts the search will run and info will be displayed to the screen about what happened. If you chose to output the results to a file, that file will contain matches for the text along with what lines in the file actually contained the text.

NOTE: If you want to skip all the prompts, open the finder.js file and set the GO_MODE const to true (also set BASE_PATH to whatever directory you want it to start searching from).

Running finder:

screenshot

Output file example:

screenshot2

If you want to write you're own script to use the go-find module instanciate a gofind object, set the properties then call the run() method.

var gofind = require('go-find');

var finder              = new gofind();
finder.startDirectory   = "/Users/ollie/wwwroot/";
finder.searchRecursive  = true;
finder.searchText       = "Mystery Man";
finder.caseSensitive    = true;
finder.wholeWord        = true;
finder.ignored          = [".svn","test","about.html"];
finder.matchOutputFile  = "/Users/ollie/wwwroot/sickwebapp/logs/mysteryman_matches.txt";
finder.ignoreOutputFile ='/Users/ollie/wwwroot/sickwebapp/logs/ignored.txt';
finder.showMatchLineNumbers = true;
finder.quietMode        = false;
finder.writeMatchFile   = false;
finder.writeIgnoreFile  = false;

// Call run to execute the search
finder.run();

Mutable Properties (options, yo)

The following properties can be set on the gofind object.

startDirectory - Full path to the directory on your filesystem to begin the search - full file path (string) - undefined - Yes

searchRecursive - Flag to search recursively from startDirectory (by default just searches files in the start directory) - true or false (boolean) - false - No

searchText - The text to search for in files - some text (string) - undefined - Yes

caseSensitive - Flag to indicate whether the searchText match should be case-sensative or not - true or false (boolean) - false - No

wholeWord - Flag to indicate whether or not to match on a whole word only or match only - true or false (boolean) - true - No

matchOutputFile - The full path to a file that will have a list of files containing the search text - full path to a file (string) - matched.txt - No

writeMatchFile - Flag to indicate if you don't want it to produce a file with list of matches (i.e. outputFile) - true or false (boolean) - false - No

showMatchLineNumbers - Flag to indicate if the output text file should include the matching line number and line of where match was found - - true or false (boolean) - false - No

ignored - Files or directories that will be ignored - array of strings that can be a directory or a specific file - empty array - No

ignoreOutputFile - The full path to a file that will have a list of files and directories that were ignored - full path to a file (string) - ignored.txt - No

writeIgnoreFile - Flag to indicate if you don' want it to produce a file with a list of files or directory ignored when searching - true or false (boolean) - true - No

quietMode - Flag to turn on or off the console output - true or false (boolean) - false - No

##Tests Run npm test to fire off the specs in the tests directory. Feel free to write some more tests for it, I did not go HAM on tests for this guy.