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

Return file names? #78

Closed
goldingdamien opened this issue Jan 24, 2019 · 5 comments
Closed

Return file names? #78

goldingdamien opened this issue Jan 24, 2019 · 5 comments
Assignees
Milestone

Comments

@goldingdamien
Copy link

Any chance of adding way to return filenames or file objects?
#64

something like below:
.returns('filename') // 'path' - default, filename, file.

I understand the desire to keep things simple, but this library provides more than just file names due to the chaining mechanism which could be applied to more situations.

Regards.

@nspragg nspragg self-assigned this Jan 24, 2019
@nspragg
Copy link
Owner

nspragg commented Jan 24, 2019

@goldingdamien - thanks for raising this. It would be good to drill down into some more detail.

Can you provide some example situations/scenarios you had in mind?

If the library could be configured to return file objects, which object would you expect? It uses an internal representation of a file internally (file-js). Or maybe a custom object? i.e just containing basic file stat info?

@goldingdamien
Copy link
Author

Basic file info is probably best as I think many people would expect or be more familiar with it.
The main issue is that this library filters out files and provides only the paths.
I have not seen the internal code, but I assume it works with file objects so I assume that it should be simple with little negative effect to be able to return the filtered data by files instead of a subset(paths) of the files.
Personally, I was using for paths then realized I had another situation where I need file stat info. Ideally, it should of been a little config tweak to get files instead.
Regards.

@nspragg
Copy link
Owner

nspragg commented Jan 28, 2019

In V2 of FileHound I'll consider returning a more feature rich file object. However, for V1, I can return a simple file object containing path and stats properties. This would be configured by invoking includeFileStats

For example:

const results = await FileHound.create()
        .path(fixtureDir + '/justFiles')
        .includeFileStats()
        .find();

console.log(results) // an array of file objects e.g [ {path: 'myPath', stats: {}} ] 

Does that meet your requirements? If so, I should be able to do a minor release with 24hrs.

@nspragg nspragg added this to the v1.17.0 milestone Jan 28, 2019
@goldingdamien
Copy link
Author

Yes, the stats would be great, thanks.

@nspragg
Copy link
Owner

nspragg commented Jan 28, 2019

@goldingdamien - support added for including file stats in v1.17.0

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