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

readdir-enhanced

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readdir-enhanced - npm Package Compare versions

Comparing version 5.1.1 to 6.0.0

index.d.ts

12

CHANGELOG.md
Change Log
====================================================================================================
All notable changes will be documented in this file.
`readdir-enhanced` adheres to [Semantic Versioning](http://semver.org/).
Readdir Enhanced adheres to [Semantic Versioning](http://semver.org/).
[v6.0.0](https://github.com/JS-DevTools/readdir-enhanced/tree/v6.0.0) (2020-02-17)
----------------------------------------------------------------------------------------------------
- Moved Readdir Enhanced to the [@JSDevTools scope](https://www.npmjs.com/org/jsdevtools) on NPM
- The "readdir-enhanced" NPM package is now just a wrapper around the scoped "@jsdevtools/readdir-enhanced" package
[Full Changelog](https://github.com/JS-DevTools/readdir-enhanced/compare/v5.1.1...v6.0.0)
[v5.1.0](https://github.com/JS-DevTools/readdir-enhanced/tree/v5.1.0) (2019-11-07)

@@ -8,0 +18,0 @@ ----------------------------------------------------------------------------------------------------

49

package.json
{
"name": "readdir-enhanced",
"version": "5.1.1",
"version": "6.0.0",
"description": "fs.readdir with sync, async, streaming, and async iterator APIs + filtering, recursion, absolute paths, etc.",

@@ -33,49 +33,14 @@ "keywords": [

},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "index.js",
"types": "index.d.ts",
"files": [
"lib"
"index.js",
"index.d.ts"
],
"scripts": {
"clean": "shx rm -rf .nyc_output coverage lib",
"lint": "npm run lint:typescript && npm run lint:javascript",
"lint:typescript": "tslint -p tsconfig.json",
"lint:javascript": "eslint test",
"build": "tsc",
"watch": "tsc --watch",
"test": "npm run test:node && npm run test:typescript && npm run lint",
"test:node": "mocha",
"test:typescript": "tsc --noEmit --strict --lib esnext test/specs/typescript-definition.spec.ts",
"coverage": "nyc node_modules/mocha/bin/mocha",
"upgrade": "npm-check -u && npm audit fix",
"bump": "bump --tag --push --all",
"release": "npm run upgrade && npm run clean && npm run build && npm test && npm run bump"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"devDependencies": {
"@types/chai": "^4.2.4",
"@types/mocha": "^5.2.7",
"@types/node": "^12.12.7",
"chai": "^4.2.0",
"coveralls": "^3.0.7",
"del": "^5.1.0",
"eslint": "^6.6.0",
"eslint-config-modular": "^7.0.1",
"mkdirp": "^0.5.1",
"mocha": "^6.2.2",
"npm-check": "^5.9.0",
"nyc": "^14.1.1",
"shx": "^0.3.2",
"through2": "^3.0.0",
"tslint": "^5.20.1",
"tslint-modular": "^1.6.0",
"typescript": "^3.7.2",
"typescript-tslint-plugin": "^0.5.4",
"version-bump-prompt": "^5.0.5"
},
"dependencies": {
"file-path-filter": "^2.2.2"
"@jsdevtools/readdir-enhanced": "6.0.0"
}
}
Enhanced `fs.readdir()`
=======================
[![Cross-Platform Compatibility](https://jstools.dev/img/badges/os-badges.svg)](https://travis-ci.com/JS-DevTools/readdir-enhanced)
[![Build Status](https://api.travis-ci.com/JS-DevTools/readdir-enhanced.svg?branch=master)](https://travis-ci.com/JS-DevTools/readdir-enhanced)
[![Cross-Platform Compatibility](https://jstools.dev/img/badges/os-badges.svg)](https://github.com/JS-DevTools/readdir-enhanced/blob/master/.github/workflows/CI-CD.yaml)
[![Build Status](https://github.com/JS-DevTools/readdir-enhanced/workflows/CI-CD/badge.svg)](https://github.com/JS-DevTools/readdir-enhanced/blob/master/.github/workflows/CI-CD.yaml)

@@ -35,3 +35,3 @@ [![Coverage Status](https://coveralls.io/repos/github/JS-DevTools/readdir-enhanced/badge.svg?branch=master)](https://coveralls.io/github/JS-DevTools/readdir-enhanced?branch=master)

```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";
import through2 from "through2";

@@ -79,3 +79,3 @@

----------------------------------
`readdir-enhanced` has multiple APIs, so you can pick whichever one you prefer. Here are some things to consider about each API:
Readdir Enhanced has multiple APIs, so you can pick whichever one you prefer. Here are some things to consider about each API:

@@ -109,3 +109,3 @@ |Function|Returns|Syntax|[Blocks the thread?](#blocking-the-thread)|[Buffers results?](#buffered-results)|

```javascript
import { readdirSync, readdirAsync, readdirIterator, readdirStream } from "readdir-enhanced";
import { readdirSync, readdirAsync, readdirIterator, readdirStream } from "@jsdevtools/readdir-enhanced";
```

@@ -118,3 +118,3 @@

----------------------------------
`readdir-enhanced` adds several features to the built-in `fs.readdir()` function. All of the enhanced features are opt-in, which makes `readdir-enhanced` [fully backward compatible by default](#backward-compatible). You can enable any of the features by passing-in an `options` argument as the second parameter.
Readdir Enhanced adds several features to the built-in `fs.readdir()` function. All of the enhanced features are opt-in, which makes Readdir Enhanced [fully backward compatible by default](#backward-compatible). You can enable any of the features by passing-in an `options` argument as the second parameter.

@@ -126,3 +126,3 @@

----------------------------------
By default, `readdir-enhanced` will only return the top-level contents of the starting directory. But you can set the `deep` option to recursively traverse the subdirectories and return their contents as well.
By default, Readdir Enhanced will only return the top-level contents of the starting directory. But you can set the `deep` option to recursively traverse the subdirectories and return their contents as well.

@@ -134,3 +134,3 @@ ### Crawl ALL subdirectories

```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";

@@ -152,3 +152,3 @@ readdir("my/directory", {deep: true}, (err, files) => {

```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";

@@ -171,3 +171,3 @@ readdir("my/directory", {deep: 2}, (err, files) => {

```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";

@@ -193,3 +193,3 @@ // Only crawl the "lib" and "bin" subdirectories

```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";

@@ -225,3 +225,3 @@ // Crawl all subdirectories, except "node_modules"

```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";

@@ -244,3 +244,3 @@ // Find all .txt files

```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";

@@ -266,3 +266,3 @@ // Only return file names containing an underscore

------------------------------------------------------------
All of the `readdir-enhanced` functions listed above return an array of strings (paths). But in some situations, the path isn't enough information. Setting the `stats` option returns an array of [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) objects instead of path strings. The `fs.Stats` object contains all sorts of useful information, such as the size, the creation date/time, and helper methods such as `isFile()`, `isDirectory()`, `isSymbolicLink()`, etc.
All of the Readdir Enhanced functions listed above return an array of strings (paths). But in some situations, the path isn't enough information. Setting the `stats` option returns an array of [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) objects instead of path strings. The `fs.Stats` object contains all sorts of useful information, such as the size, the creation date/time, and helper methods such as `isFile()`, `isDirectory()`, `isSymbolicLink()`, etc.

@@ -272,3 +272,3 @@ > **NOTE:** The [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) objects that are returned also have additional `path` and `depth` properties. The `path` is relative to the starting directory by default, but you can customize this via [`options.basePath`](#basepath). The `depth` is the number of subdirectories beneath the base path (see [`options.deep`](#deep)).

```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";

@@ -287,6 +287,6 @@ readdir("my/directory", { stats: true }, (err, stats) => {

----------------------------------
By default all `readdir-enhanced` functions return paths that are relative to the starting directory. But you can use the `basePath` option to customize this. The `basePath` will be prepended to all of the returned paths. One common use-case for this is to set `basePath` to the absolute path of the starting directory, so that all of the returned paths will be absolute.
By default all Readdir Enhanced functions return paths that are relative to the starting directory. But you can use the `basePath` option to customize this. The `basePath` will be prepended to all of the returned paths. One common use-case for this is to set `basePath` to the absolute path of the starting directory, so that all of the returned paths will be absolute.
```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";
import { resolve } from "path";

@@ -317,6 +317,6 @@

----------------------------------
By default, `readdir-enhanced` uses the correct path separator for your OS (`\` on Windows, `/` on Linux & MacOS). But you can set the `sep` option to any separator character(s) that you want to use instead. This is usually used to ensure consistent path separators across different OSes.
By default, Readdir Enhanced uses the correct path separator for your OS (`\` on Windows, `/` on Linux & MacOS). But you can set the `sep` option to any separator character(s) that you want to use instead. This is usually used to ensure consistent path separators across different OSes.
```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";

@@ -340,6 +340,6 @@ // Always use Windows path separators

----------------------------------
By default, `readdir-enhanced` uses the default [Node.js FileSystem module](https://nodejs.org/api/fs.html) for methods like `fs.stat`, `fs.readdir` and `fs.lstat`. But in some situations, you can want to use your own FS methods (FTP, SSH, remote drive and etc). So you can provide your own implementation of FS methods by setting `options.fs` or specific methods, such as `options.fs.stat`.
By default, Readdir Enhanced uses the default [Node.js FileSystem module](https://nodejs.org/api/fs.html) for methods like `fs.stat`, `fs.readdir` and `fs.lstat`. But in some situations, you can want to use your own FS methods (FTP, SSH, remote drive and etc). So you can provide your own implementation of FS methods by setting `options.fs` or specific methods, such as `options.fs.stat`.
```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";

@@ -367,6 +367,6 @@ function myCustomReaddirMethod(dir, callback) {

-------------------------------------
`readdir-enhanced` is fully backward-compatible with Node.js' built-in `fs.readdir()` and `fs.readdirSync()` functions, so you can use it as a drop-in replacement in existing projects without affecting existing functionality, while still being able to use the enhanced features as needed.
Readdir Enhanced is fully backward-compatible with Node.js' built-in `fs.readdir()` and `fs.readdirSync()` functions, so you can use it as a drop-in replacement in existing projects without affecting existing functionality, while still being able to use the enhanced features as needed.
```javascript
import { readdir, readdirSync } from "readdir-enhanced";
import { readdir, readdirSync } from "@jsdevtools/readdir-enhanced";

@@ -384,7 +384,7 @@ // Use it just like Node's built-in fs.readdir function

----------------------------------
The `readdir-enhanced` streaming API follows the Node.js streaming API. A lot of questions around the streaming API can be answered by reading the [Node.js documentation.](https://nodejs.org/api/stream.html). However, we've tried to answer the most common questions here.
The Readdir Enhanced streaming API follows the Node.js streaming API. A lot of questions around the streaming API can be answered by reading the [Node.js documentation.](https://nodejs.org/api/stream.html). However, we've tried to answer the most common questions here.
### Stream Events
All events in the Node.js streaming API are supported by `readdir-enhanced`. These events include "end", "close", "drain", "error", plus more. [An exhaustive list of events is available in the Node.js documentation.](https://nodejs.org/api/stream.html#stream_class_stream_readable)
All events in the Node.js streaming API are supported by Readdir Enhanced. These events include "end", "close", "drain", "error", plus more. [An exhaustive list of events is available in the Node.js documentation.](https://nodejs.org/api/stream.html#stream_class_stream_readable)

@@ -396,3 +396,3 @@ #### Detect when the Stream has finished

```javascript
import readdir from "readdir-enhanced";
import readdir from "@jsdevtools/readdir-enhanced";

@@ -411,3 +411,3 @@ // Build the stream using the Streaming API

As with all Node.js streams, a `readdir-enhanced` stream starts in "paused mode". For the stream to start emitting files, you'll need to switch it to "flowing mode".
As with all Node.js streams, a Readdir Enhanced stream starts in "paused mode". For the stream to start emitting files, you'll need to switch it to "flowing mode".

@@ -442,3 +442,3 @@ There are many ways to trigger flowing mode, such as adding a `stream.data()` handler, using `stream.pipe()` or calling `stream.resume()`.

--------------------------
`readdir-enhanced` is 100% free and open-source, under the [MIT license](LICENSE). Use it however you want.
Readdir Enhanced is 100% free and open-source, under the [MIT license](LICENSE). Use it however you want.

@@ -445,0 +445,0 @@

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