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

fs-helper

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-helper

A helper library to provide provide additonal functions for commonly performed file system operations.

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

#fs-helper

Overview

This is a node module created in order help provide additonal functions for commonly performed file system operations.

Methods

getDirPathsRecursivelyByNameSync(current_directory, subdirectory_names, [subdirectories_found])

Description

This function takes in the top level directory to search, an array of directory names that are the desired name to be located. There is also an optional parameter "subdirectories_found", which is used for recursive calls to this function.

Then it recursively searches sub-directories for directory names that are contained in the "subdirectory_names". If a directory is found that exists in "subdirectory_names" it is added to the "subdirectories_found" array.

This returns an array of the paths to each subdirectory with the matching directory path that was found.

Example Usage

Directory Structure:
/Users/username/node project/
|__directories
    |__example directory
        |__file.txt
    |__not example directory
        |__file.txt
|__other directories
    |__example directory
        |__file.txt
    |__not example directory
        |__file.txt

var subdir_paths = fsHelper.getDirPathsRecursivelyByNameSync('/Users/username/node project/', ['example directory']);

The result of this operation is that subdir_paths will contain the strings:

  • /Users/username/node project/directories/example directory
  • /Users/username/node project/other directories/example directory

Keywords

FAQs

Package last updated on 24 Dec 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