Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

findit

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

findit

walk a directory tree recursively with events

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
115K
decreased by-3.96%
Maintainers
1
Weekly downloads
 
Created

What is findit?

The 'findit' npm package is a simple and efficient tool for recursively searching through directories to find files and directories. It emits events for each file and directory it encounters, making it easy to handle file system traversal in a Node.js application.

What are findit's main functionalities?

Finding Files

This feature allows you to search for files within a specified directory. The 'file' event is emitted for each file found, and you can handle it by logging the file path or performing other operations.

const findit = require('findit');
const finder = findit('/path/to/search');

finder.on('file', (file, stat) => {
  console.log('File: ' + file);
});

Finding Directories

This feature allows you to search for directories within a specified directory. The 'directory' event is emitted for each directory found, and you can handle it by logging the directory path or performing other operations.

const findit = require('findit');
const finder = findit('/path/to/search');

finder.on('directory', (dir, stat, stop) => {
  console.log('Directory: ' + dir);
});

Handling Errors

This feature allows you to handle errors that occur during the search process. The 'error' event is emitted when an error is encountered, and you can handle it by logging the error or performing other error-handling operations.

const findit = require('findit');
const finder = findit('/path/to/search');

finder.on('error', (err) => {
  console.error('Error: ' + err);
});

Stopping the Search

This feature allows you to stop the search process based on certain conditions. The 'stop' function can be called within the 'directory' event handler to halt the search when a specific directory is encountered.

const findit = require('findit');
const finder = findit('/path/to/search');

finder.on('directory', (dir, stat, stop) => {
  if (dir === '/path/to/stop') stop();
});

Other packages similar to findit

Keywords

FAQs

Package last updated on 01 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc