Socket
Socket
Sign inDemoInstall

file-tree-walker

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-tree-walker

walk file tree sync.


Version published
Maintainers
1
Created
Source

walk the file tree synchronously, asynchronous it is meaningless to "VISIT_RESULT" for this library.

Usage

  • VISIT_RESULT

    • CONTINUE

      visit next file.

    • TERMINATE

      terminate task, return immediately.

    • SKIP_TREE

      ignore siblings of the directories and files.

    • SKIP

      ignore this file or directory.

  • walkFileTree ( path , [options] )

    • options

      • maxDepth

        default value is 16

Example

let fileTreeWalker=require("file-tree-walker");
let {VISIT_RESULT}=require("file-tree-walker");
let path=require("path");

fileTreeWalker.walkFileTree(path.resolve("C:/","windows"),{
	perVisitDirectory(dir,stat)
	{
		return VISIT_RESULT.CONTINUE;
	},

	postVisitDirectory(dir,stat,error)
	{
		if(error)
		{
			console.log(error);
		}
		return VISIT_RESULT.CONTINUE;
	},

	visitFileFailed(file,error)
	{
		if(error)
		{
			console.log(error);
		}
		return VISIT_RESULT.CONTINUE;
	},

	postVisitFile(file,stat)
	{
		console.log(file);
		return VISIT_RESULT.CONTINUE;
	}
},{
	maxDepth:2
});

Keywords

FAQs

Package last updated on 02 Oct 2018

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