Skip to content

Commit 83fe12d

Browse files
Moved "readdir-enhanced" to the @jsdevtools scope
1 parent f8121be commit 83fe12d

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Change Log
22
====================================================================================================
33
All notable changes will be documented in this file.
4-
`readdir-enhanced` adheres to [Semantic Versioning](http://semver.org/).
4+
Readdir Enhanced adheres to [Semantic Versioning](http://semver.org/).
55

66

77
[v5.1.0](https://github.com/JS-DevTools/readdir-enhanced/tree/v5.1.0) (2019-11-07)

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Example
3232
----------------------------------
3333

3434
```javascript
35-
import readdir from "readdir-enhanced";
35+
import readdir from "@jsdevtools/readdir-enhanced";
3636
import through2 from "through2";
3737

3838
// Synchronous API
@@ -75,7 +75,7 @@ let stream = readdir.stream("my/directory")
7575
7676
Pick Your API
7777
----------------------------------
78-
`readdir-enhanced` has multiple APIs, so you can pick whichever one you prefer. Here are some things to consider about each API:
78+
Readdir Enhanced has multiple APIs, so you can pick whichever one you prefer. Here are some things to consider about each API:
7979
8080
|Function|Returns|Syntax|[Blocks the thread?](#blocking-the-thread)|[Buffers results?](#buffered-results)|
8181
|---|---|---|---|---|
@@ -104,29 +104,29 @@ The [example above](#example) imported the `readdir` default export and used its
104104
Here's how to import named exports rather than the default export:
105105
106106
```javascript
107-
import { readdirSync, readdirAsync, readdirIterator, readdirStream } from "readdir-enhanced";
107+
import { readdirSync, readdirAsync, readdirIterator, readdirStream } from "@jsdevtools/readdir-enhanced";
108108
```
109109
110110
111111
112112
<a id="options"></a>
113113
Enhanced Features
114114
----------------------------------
115-
`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.
115+
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.
116116
117117
118118
119119
<a id="deep"></a>
120120
Crawl Subdirectories
121121
----------------------------------
122-
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.
122+
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.
123123
124124
### Crawl ALL subdirectories
125125
126126
The `deep` option can be set to `true` to traverse the entire directory structure.
127127
128128
```javascript
129-
import readdir from "readdir-enhanced";
129+
import readdir from "@jsdevtools/readdir-enhanced";
130130

131131
readdir("my/directory", {deep: true}, (err, files) => {
132132
console.log(files);
@@ -143,7 +143,7 @@ readdir("my/directory", {deep: true}, (err, files) => {
143143
The `deep` option can be set to a number to only traverse that many levels deep. For example, calling `readdir("my/directory", {deep: 2})` will return `subdir1/file.txt` and `subdir1/subdir2/file.txt`, but it _won't_ return `subdir1/subdir2/subdir3/file.txt`.
144144
145145
```javascript
146-
import readdir from "readdir-enhanced";
146+
import readdir from "@jsdevtools/readdir-enhanced";
147147

148148
readdir("my/directory", {deep: 2}, (err, files) => {
149149
console.log(files);
@@ -161,7 +161,7 @@ For simple use-cases, you can use a [regular expression](https://developer.mozil
161161
> **NOTE:** Glob patterns [_always_ use forward-slashes](https://github.com/isaacs/node-glob#windows), even on Windows. This _does not_ apply to regular expressions though. Regular expressions should use the appropraite path separator for the environment. Or, you can match both types of separators using `[\\/]`.
162162
163163
```javascript
164-
import readdir from "readdir-enhanced";
164+
import readdir from "@jsdevtools/readdir-enhanced";
165165

166166
// Only crawl the "lib" and "bin" subdirectories
167167
// (notice that the "node_modules" subdirectory does NOT get crawled)
@@ -182,7 +182,7 @@ For more advanced recursion, you can set the `deep` option to a function that ac
182182
> **NOTE:** The [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that's passed to the function has 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)).
183183
184184
```javascript
185-
import readdir from "readdir-enhanced";
185+
import readdir from "@jsdevtools/readdir-enhanced";
186186

187187
// Crawl all subdirectories, except "node_modules"
188188
function ignoreNodeModules (stats) {
@@ -213,7 +213,7 @@ For simple use-cases, you can use a [regular expression](https://developer.mozil
213213
> **NOTE:** Glob patterns [_always_ use forward-slashes](https://github.com/isaacs/node-glob#windows), even on Windows. This _does not_ apply to regular expressions though. Regular expressions should use the appropraite path separator for the environment. Or, you can match both types of separators using `[\\/]`.
214214
215215
```javascript
216-
import readdir from "readdir-enhanced";
216+
import readdir from "@jsdevtools/readdir-enhanced";
217217

218218
// Find all .txt files
219219
readdir("my/directory", {filter: "*.txt"});
@@ -231,7 +231,7 @@ For more advanced filtering, you can specify a filter function that accepts an [
231231
> **NOTE:** The [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that's passed to the filter function has 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)).
232232
233233
```javascript
234-
import readdir from "readdir-enhanced";
234+
import readdir from "@jsdevtools/readdir-enhanced";
235235

236236
// Only return file names containing an underscore
237237
function myFilter(stats) {
@@ -252,12 +252,12 @@ readdir("my/directory", {filter: myFilter}, (err, files) => {
252252
<a id="stats"></a>
253253
Get `fs.Stats` objects instead of strings
254254
------------------------------------------------------------
255-
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.
255+
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.
256256
257257
> **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)).
258258
259259
```javascript
260-
import readdir from "readdir-enhanced";
260+
import readdir from "@jsdevtools/readdir-enhanced";
261261

262262
readdir("my/directory", { stats: true }, (err, stats) => {
263263
for (let stat of stats) {
@@ -271,10 +271,10 @@ readdir("my/directory", { stats: true }, (err, stats) => {
271271
<a id="basepath"></a>
272272
Base Path
273273
----------------------------------
274-
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.
274+
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.
275275
276276
```javascript
277-
import readdir from "readdir-enhanced";
277+
import readdir from "@jsdevtools/readdir-enhanced";
278278
import { resolve } from "path";
279279

280280
// Get absolute paths
@@ -300,10 +300,10 @@ readdir("my/directory", {basePath: "my/directory"}, (err, files) => {
300300
<a id="sep"></a>
301301
Path Separator
302302
----------------------------------
303-
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.
303+
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.
304304
305305
```javascript
306-
import readdir from "readdir-enhanced";
306+
import readdir from "@jsdevtools/readdir-enhanced";
307307

308308
// Always use Windows path separators
309309
readdir("my/directory", {sep: "\\", deep: true}, (err, files) => {
@@ -322,10 +322,10 @@ readdir("my/directory", {sep: "\\", deep: true}, (err, files) => {
322322
<a id="fs"></a>
323323
Custom FS methods
324324
----------------------------------
325-
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`.
325+
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`.
326326
327327
```javascript
328-
import readdir from "readdir-enhanced";
328+
import readdir from "@jsdevtools/readdir-enhanced";
329329

330330
function myCustomReaddirMethod(dir, callback) {
331331
callback(null, ["__myFile.txt"]);
@@ -348,10 +348,10 @@ readdir("my/directory", options, (err, files) => {
348348
<a id="backward-compatible"></a>
349349
Backward Compatible
350350
-------------------------------------
351-
`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.
351+
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.
352352
353353
```javascript
354-
import { readdir, readdirSync } from "readdir-enhanced";
354+
import { readdir, readdirSync } from "@jsdevtools/readdir-enhanced";
355355

356356
// Use it just like Node's built-in fs.readdir function
357357
readdir("my/directory", (er, files) => { ... });
@@ -364,18 +364,18 @@ let files = readdirSync("my/directory");
364364
365365
A Note on Streams
366366
----------------------------------
367-
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.
367+
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.
368368
369369
### Stream Events
370370
371-
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)
371+
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)
372372
373373
#### Detect when the Stream has finished
374374
375375
Using these events, we can detect when the stream has finished reading files.
376376
377377
```javascript
378-
import readdir from "readdir-enhanced";
378+
import readdir from "@jsdevtools/readdir-enhanced";
379379

380380
// Build the stream using the Streaming API
381381
let stream = readdir.stream("my/directory")
@@ -389,7 +389,7 @@ stream.on("end", () => {
389389
390390
### Paused Streams vs. Flowing Streams
391391
392-
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".
392+
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".
393393
394394
There are many ways to trigger flowing mode, such as adding a `stream.data()` handler, using `stream.pipe()` or calling `stream.resume()`.
395395
@@ -419,7 +419,7 @@ To build the project locally on your computer:
419419

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

424424

425425

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "readdir-enhanced",
2+
"name": "@jsdevtools/readdir-enhanced",
33
"version": "5.1.1",
44
"description": "fs.readdir with sync, async, streaming, and async iterator APIs + filtering, recursion, absolute paths, etc.",
55
"keywords": [

0 commit comments

Comments
 (0)