Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to use depth in the custom deep function #7

Closed
mrmlnc opened this issue Aug 20, 2017 · 2 comments
Closed

Ability to use depth in the custom deep function #7

mrmlnc opened this issue Aug 20, 2017 · 2 comments

Comments

@mrmlnc
Copy link
Collaborator

mrmlnc commented Aug 20, 2017

If we use deep option as custom function we cannot control depth. May be we must provide number of depth to function arguments?

For example:

const options = {
	deep: (entry: IReaddirEntry, depth: number) => ...
};
@JamesMessinger
Copy link
Member

Good point. I'll plan to add a .depth property to the Stats object that's passed to the function.

For the time being though, you can determine the depth by the number of path separators in the .path property. Like this:

var depth = stats.path.split('/').length;

@mrmlnc
Copy link
Collaborator Author

mrmlnc commented Aug 20, 2017

Yeap, thanks for your answer! Now I use similar code snippet, but will be cool if this property will be available in the Stats object.

Sent from my Xiaomi Redmi Note 4X using FastHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants