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

klaw-sync

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

klaw-sync

Recursive, synchronous, and fast file system walker

  • 6.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6M
decreased by-42.47%
Maintainers
1
Weekly downloads
 
Created

What is klaw-sync?

The klaw-sync npm package is a Node.js module that allows users to recursively walk ('klaw') through the file system synchronously. It is useful for tasks such as reading all files in a directory and its subdirectories, filtering files by certain criteria, and obtaining file stats in a synchronous manner.

What are klaw-sync's main functionalities?

Recursive file listing

This feature allows you to list all files and directories within a given directory recursively. The example code lists all paths within '/some/directory'.

const klawSync = require('klaw-sync');
const paths = klawSync('/some/directory');
console.log(paths);

Filtering files

This feature allows you to filter the files and directories based on a custom function. In the example, only '.txt' files are listed.

const klawSync = require('klaw-sync');
const path = require('path');
const filterFn = item => path.extname(item.path) === '.txt';
const txtFiles = klawSync('/some/directory', { filter: filterFn });
console.log(txtFiles);

Including file stats

This feature allows you to include file stats in the output. The example code lists directories (excluding files) within '/some/directory' and includes their stats.

const klawSync = require('klaw-sync');
const pathsWithStats = klawSync('/some/directory', { nofile: true, stats: true });
console.log(pathsWithStats);

Other packages similar to klaw-sync

Keywords

FAQs

Package last updated on 23 Sep 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