-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(utils): feat: use
@nodelib/fs.walk
[wip]
- Loading branch information
Showing
19 changed files
with
142 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import * as readdir from '@mrmlnc/readdir-enhanced'; | ||
import * as fsWalk from '@nodelib/fs.walk'; | ||
|
||
import FileSystemStream from '../adapters/fs-stream'; | ||
import { EntryFilterFunction, ReaderOptions } from '../types/index'; | ||
import { ReaderOptions } from '../types/index'; | ||
import Reader from './reader'; | ||
|
||
export default class ReaderStream extends Reader<NodeJS.ReadableStream> { | ||
private readonly _fsAdapter: FileSystemStream = new FileSystemStream(this._settings); | ||
|
||
public dynamic(root: string, options: ReaderOptions): NodeJS.ReadableStream { | ||
return readdir.readdirStreamStat(root, options); | ||
return fsWalk.walkStream(root, options); | ||
} | ||
|
||
public static(filepaths: string[], options: ReaderOptions): NodeJS.ReadableStream { | ||
return this._fsAdapter.read(filepaths, options.filter as EntryFilterFunction); | ||
return this._fsAdapter.read(filepaths, options.entryFilter); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import * as readdir from '@mrmlnc/readdir-enhanced'; | ||
import * as fsWalk from '@nodelib/fs.walk'; | ||
|
||
import FileSystemSync from '../adapters/fs-sync'; | ||
import { Entry, EntryFilterFunction, ReaderOptions } from '../types/index'; | ||
import { Entry, ReaderOptions } from '../types/index'; | ||
import Reader from './reader'; | ||
|
||
export default class ReaderSync extends Reader<Entry[]> { | ||
private readonly _fsAdapter: FileSystemSync = new FileSystemSync(this._settings); | ||
|
||
public dynamic(root: string, options: ReaderOptions): Entry[] { | ||
return readdir.readdirSyncStat(root, options); | ||
return fsWalk.walkSync(root, options); | ||
} | ||
|
||
public static(filepaths: string[], options: ReaderOptions): Entry[] { | ||
return this._fsAdapter.read(filepaths, options.filter as EntryFilterFunction); | ||
return this._fsAdapter.read(filepaths, options.entryFilter); | ||
} | ||
} |
Oops, something went wrong.