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

path-printer

v1.0.7

Published

PathPrinter is a CLI tool that reads one or more files and prints the content, with the file path as a comment on the first line. It can handle full file paths or recursively search for files in the current directory and its subdirectories based on the fi

Downloads

4

Readme

PathPrinter

PathPrinter is a CLI tool that reads one or more files and prints the content, with the file path as a comment on the first line. It can handle full file paths or recursively search for files in the current directory and its subdirectories based on the file name provided.

Installation

You can install PathPrinter globally using npm:

npm install -g path-printer

Usage

1. Single File:

You can provide either the full file path or just the file name. If a full path is provided, PathPrinter will output the file content directly. If only the file name is provided, it will recursively search for the file from the current directory.

pathprinter path/to/file.tsx

Or, if only the file name is provided:

pathprinter file.tsx

If the file is found, the output will look like:

// /absolute/path/to/file.tsx

<file content here>

2. Multiple Files:

You can specify multiple file paths or file names separated by commas. PathPrinter will either output the files directly (if paths are provided) or recursively search for them (if names are provided).

pathprinter path/to/file1.tsx,path/to/file2.tsx

If the files are found, the output will look like this:

// /absolute/path/to/file1.tsx

<file1 content here>

// /absolute/path/to/file2.tsx

<file2 content here>

You can also mix file paths and file names:

pathprinter path/to/file1.tsx,file2.tsx

If the file name is found after a recursive search, the content will be displayed as expected.

3. Handling Multiple Files with the Same Name:

If multiple files with the same name exist in different directories, PathPrinter will prompt you to select which file you want to output.

Example:

pathprinter index.tsx

Output:

Multiple files found:
1: /project/src/pages/index.tsx
2: /project/src/components/header/index.tsx
3: /project/src/admin/index.tsx
Please select the file number:

You can then select the appropriate file by entering the corresponding number (e.g., 1).

4. Error Handling:

  • If a provided path or file name is not found, PathPrinter will notify you that the file could not be located.
  • If invalid input or file names are provided, the tool will return an error message and exit.

License

MIT