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

@mrmlnc/readdir-enhanced

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mrmlnc/readdir-enhanced

fs.readdir with sync, async, and streaming APIs + filtering, recursion, absolute paths, etc.

  • 2.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
decreased by-57.97%
Maintainers
1
Weekly downloads
 
Created

What is @mrmlnc/readdir-enhanced?

The @mrmlnc/readdir-enhanced npm package is a Node.js library that provides a powerful and flexible way to read the contents of a directory. It allows for synchronous and asynchronous directory reading, with the ability to filter, map, and reduce the results. It can also recursively read subdirectories and stream directory entries for efficient processing of large directories.

What are @mrmlnc/readdir-enhanced's main functionalities?

Asynchronous directory reading

Reads the contents of a directory asynchronously and returns a promise that resolves with an array of filenames.

const readdir = require('@mrmlnc/readdir-enhanced');

readdir.async('path/to/dir').then(files => {
  console.log(files);
});

Synchronous directory reading

Reads the contents of a directory synchronously and returns an array of filenames.

const readdir = require('@mrmlnc/readdir-enhanced');

const files = readdir.sync('path/to/dir');
console.log(files);

Recursive directory reading

Reads the contents of a directory and all its subdirectories recursively.

const readdir = require('@mrmlnc/readdir-enhanced');

readdir.async('path/to/dir', { deep: true }).then(files => {
  console.log(files);
});

Streaming directory entries

Streams directory entries as they are read, which is useful for efficiently processing large directories.

const readdir = require('@mrmlnc/readdir-enhanced');

const stream = readdir.stream('path/to/dir');
stream.on('data', entry => {
  console.log(entry);
});

Filtering directory entries

Filters the directory entries based on a function that receives file stats, allowing for selective reading of the directory contents.

const readdir = require('@mrmlnc/readdir-enhanced');

readdir.async('path/to/dir', { filter: stats => stats.isFile() }).then(files => {
  console.log(files);
});

Other packages similar to @mrmlnc/readdir-enhanced

Keywords

FAQs

Package last updated on 13 Feb 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