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

fz-browse

v1.0.3

Published

fz-browse is a general-purpose command-line fuzzy finder.

Downloads

4

Readme

fz-browse

fz-browse is a general-purpose command-line fuzzy finder.

fz-browse is fzf-like tool but view search results on browser.

https://user-images.githubusercontent.com/19714/163715237-e16cfafe-5e11-4d20-9398-1fbb5e845f7e.mp4

Installation

npm install --global fz-browse

Usage

Usage
  $ fz-browse [option]

Options
  --run                        [String] Run command
  --preview                    [String] Preview command
  --cwd                        [String:Path] Current working directory
  --query                      [String] Default search query
  --open                       [Boolean] If it is set, open browser automatically
  --browser                    [String] for opening browser name: "google chrome", "firefox", "microsoft edge"
  --displayItemLimit           [Number] Limit count for display search results

Examples
  # Search text contents
  fz-browse --run $'rg --ignore-case {input} --json | jq \'if .type == "begin" or .type == "match" then . else empty end | [.data.path.text, .data.lines.text] | @tsv\' -r' --preview "rg --context 5 {input} {target}"
  # Search PDF/epub books
  fz-browse --run $'rga --ignore-case {input} --json | jq \'if .type == "begin" or .type == "match" then . else empty end | [.data.path.text, .data.lines.text] | @tsv\' -r' --preview "rga --context 5 {input} {target}" --cwd "/Path/To/Your/BookDir"

Command Output Format

Run command output format

  • --run: fz-browse execute the run command when input search keywords

--run command should output following file path by line.

/path/to/file
/path/to/file
/path/to/file

Also, support following TSV list by line. If you want to display content of the file in search result, --run command should output <filepath>\t<content> pattern.

/path/to/fileA
/path/to/fileA\tContent of the file A1
/path/to/fileA\tContent of the file A2
/path/to/fileA\tContent of the file A3
/path/to/fileB
/path/to/fileB\tContent of the file B1

It will be converted to following structure on view.

<h2><a href="/preview/?target=/path/to/fileA">/path/to/fileA</a></h2>

<p>Content of the file A1</p>
<p>Content of the file A2</p>
<p>Content of the file A3</p>

<h2><a href="/preview/?target=/path/to/fileB">/path/to/fileB</a></h2>

<p>Content of the file B1</p>

:memo: Empty TSV line will be ignored.

/path/to/fileA
/path/to/fileA\tContent of the file A1
/path/to/fileA\tContent of the file A2
/path/to/fileA\tContent of the file A3
\t # This line will be ignored

Preview command output format

  • --preview: fz-browse execute the preview command when click the search result

--preview command should output following content by line.

content A
content B
content C

It will be converted to following structure on view.

<p>content A</p>
<p>content B</p>
<p>content C</p>

Architecture

architecture.

Recipes

Please add your Recipes to Wiki!: https://github.com/azu/fz-browse/wiki/Recipes

Search text contents

Show ripgrep search results

fz-browse --run $'rg --ignore-case {input} --json | jq \'if .type == "begin" or .type == "match" then . else empty end | [.data.path.text, .data.lines.text] | @tsv\' -r' --preview "rg --context 5 {input} {target}"

Search PDF and epub books

Show ripgrep-all search results

fz-browse --run $'rga --ignore-case {input} --json | jq \'if .type == "begin" or .type == "match" then . else empty end | [.data.path.text, .data.lines.text] | @tsv\' -r' --preview "rga --context 5 {input} {target}" --cwd "/Path/To/Your/BookDir"

It means that convert only "begin" and "match" JSON line to TSV.

rga test --json | jq 'if .type == "begin" or .type == "match" then 
  .     # Pass it-self to next pipe
else 
  empty # remove this live
end | [.data.path.text, .data.lines.text] | @tsv'

Open browser automatically

--open and --browser <browsername> allow you to open a browser.

fz-browse --run $'rg --ignore-case {input} --json | jq \'if .type == "begin" or .type == "match" then . else empty end | [.data.path.text, .data.lines.text] | @tsv\' -r' --preview "rg --context 5 {input} {target}" --open --browser "google chrome"

Search Images by Exif data

Search Images using exiftool.

fz-browse --run $'find -E . -iregex ".*\.(jpg|gif|png|jpeg)$" -print0 | xargs -0 exiftool -q -m -p \'$Directory/$Filename  $DateTimeOriginal  $Comment\' | grep {input} | awk \'{print $1}\'' --preview "echo {target}"

https://user-images.githubusercontent.com/19714/163715229-e05b8a7e-7708-41a1-bd07-316a177d9f35.mp4

Built-in Preview

  • PDF
  • epub
  • Image: png,jpe,jpeg,webp,gif

Develop

git clone https://github.com/azu/fz-browse
cd fz-browse
yarn install
# using vite server
NODE_ENV=develop PORT=3000 node ./cli.mjs ...

License

MIT ©️ azu