-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encapsulated additional custom properties to parent field "custom"
- Loading branch information
1 parent
a555442
commit af10d08
Showing
1 changed file
with
26 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
import { Stats } from 'fs'; | ||
|
||
declare function directoryTree( | ||
path: string, | ||
options ? : directoryTree.DirectoryTreeOptions, | ||
onEachFile ? : directoryTree.DirectoryTreeCallback, | ||
onEachDirectory ? : directoryTree.DirectoryTreeCallback, | ||
path: string, | ||
options?: directoryTree.DirectoryTreeOptions, | ||
onEachFile?: directoryTree.DirectoryTreeCallback, | ||
onEachDirectory?: directoryTree.DirectoryTreeCallback | ||
): directoryTree.DirectoryTree; | ||
|
||
export as namespace directoryTree; | ||
|
||
declare namespace directoryTree { | ||
export interface DirectoryTree { | ||
path: string; | ||
name: string; | ||
size: number; | ||
type: "directory" | "file"; | ||
children ? : DirectoryTree[]; | ||
extension?: string; | ||
isSymbolicLink?: boolean; | ||
[key: string]: any; | ||
} | ||
export interface DirectoryTreeOptions { | ||
normalizePath ? : boolean; | ||
exclude ? : RegExp | RegExp[]; | ||
attributes ? : (keyof Stats | "type" | "extension")[]; | ||
extensions ? : RegExp; | ||
followSymlink ? : boolean; | ||
} | ||
export type DirectoryTreeCallback = (item: DirectoryTree, path: string, stats: Stats) => void; | ||
export interface DirectoryTree { | ||
path: string; | ||
name: string; | ||
size: number; | ||
type: 'directory' | 'file'; | ||
children?: DirectoryTree[]; | ||
extension?: string; | ||
isSymbolicLink?: boolean; | ||
custom: { [key: string]: any }; | ||
} | ||
export interface DirectoryTreeOptions { | ||
normalizePath?: boolean; | ||
exclude?: RegExp | RegExp[]; | ||
attributes?: (keyof Stats | 'type' | 'extension')[]; | ||
extensions?: RegExp; | ||
followSymlink?: boolean; | ||
} | ||
export type DirectoryTreeCallback = ( | ||
item: DirectoryTree, | ||
path: string, | ||
stats: Stats | ||
) => void; | ||
} | ||
|
||
export = directoryTree; |