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

node-recursive-directory

v1.2.3

Published

Npm package to get directory files recursively

Downloads

12,764

Readme

Node Recursive Directory

npm version downloads

Unlock the power of Node.js with Node Recursive Directory — your ultimate solution for seamless directory traversal. Whether you're building complex file systems, developing static site generators, or just need a robust way to manage files, this package delivers unmatched simplicity, speed, and reliability.

Why Node Recursive Directory is a Must-Have

Imagine a tool so intuitive, yet powerful, that it transforms the way you handle file operations. With just a few lines of code, Node Recursive Directory allows you to:

  • Effortlessly Traverse Directories: Say goodbye to the tedious task of manually scanning folders. This tool does it all for you, diving deep into nested directories and delivering exactly the files you need.
  • Flexible and Customizable: Whether you need simple file paths or detailed file objects, Node Recursive Directory adapts to your needs. Filter by extension, exclude directories, and handle large file sets without breaking a sweat.
  • Built for Modern Development: Designed with promises and async/await in mind, this package integrates seamlessly into your Node.js projects, allowing you to focus on building, not debugging.

Installation

Get started in seconds. Install via npm:

npm install node-recursive-directory

Or yarn:

yarn add node-recursive-directory

Usage

Simple and Powerful

Using Promises

const scanDirectory = require("node-recursive-directory");

scanDirectory("./path/to/dir")
    .then((files) => console.log(files))
    .catch((err) => console.error(err));

Using async/await

const scanDirectory = require("node-recursive-directory");

(async () => {
    try {
        const files = await scanDirectory("./path/to/dir");
        console.log(files);
    } catch (err) {
        console.error(err);
    }
})();

Detailed File Information

Need more than just file paths? Get detailed file info with a simple switch.

Using Promises

const scanDirectory = require("node-recursive-directory");

scanDirectory("./path/to/dir", true)
    .then((filesObject) => console.log(filesObject))
    .catch((err) => console.error(err));

Using async/await

const scanDirectory = require("node-recursive-directory");

(async () => {
    try {
        const filesObject = await scanDirectory("./path/to/dir", true);
        console.log(filesObject);
    } catch (err) {
        console.error(err);
    }
})();

Example

const scanDirectory = require("node-recursive-directory");

// Example: Get detailed file information
(async () => {
    try {
        const filesObject = await scanDirectory("./my-project", true);
        filesObject.forEach((file) => {
            console.log(
                `Found file: \${file.filename} in directory: \${file.dirname}`
            );
        });
    } catch (err) {
        console.error("Error:", err);
    }
})();

Join Our Growing Community

Node Recursive Directory isn't just a tool—it's part of a vibrant, growing community of developers who demand efficiency, flexibility, and performance in their projects. With over 2000+ weekly downloads, developers like you are choosing this package for its simplicity and power.

But here's the thing—despite its popularity, our GitHub repository is missing something crucial: your star.

Why Should You Star This Project?

  • Support Continuous Improvement: By starring this project, you’re helping to fuel ongoing development and updates. Every star is a vote of confidence that motivates us to keep improving.
  • Be Part of the Journey: Early stargazers are special. You’re not just a user; you’re part of a journey towards building better tools for the community.
  • Help Others Discover: Your star increases the visibility of the project, helping others discover a tool that can save them time and effort.

A Special Request

We understand that starring a project on GitHub is a simple action, but it means the world to us. If Node Recursive Directory has made your work easier or saved you time, please consider giving us a star.

We promise to continue delivering quality updates, listening to your feedback, and making Node Recursive Directory even better with each release.

Star the Repository on GitHub

Thank you for your support!

Contributions

Contributions are always welcome! If you have ideas for new features, improvements, or just want to report an issue, head over to our GitHub repository. Let's build something great together!