-
Notifications
You must be signed in to change notification settings - Fork 106
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
"Attributes" not working as expected #74
Comments
Indeed, there are a few attrs that are always present - https://github.com/mihneadb/node-directory-tree/blob/master/lib/directory-tree.js#L76-L78 and https://github.com/mihneadb/node-directory-tree/blob/master/lib/directory-tree.js#L102-L103. Should be easy to fix. Probably |
Thanks for the quick response, @mihneadb , appreciate it! In my opinion, only "name", "path" and "children" are necessary fields that should be toggled by default. If you think other attributes need to be on by default, I would argue it would be preferable for those attributes to be consistent across both files and directories (all nodes get "extension", all nodes get "size", etc) so they could be easily disabled within the attributes option rather than produce unexpected behavior (turned off for files, turned on for directories). The last option would be to have fileAttributes and directoryAttributes separate objects in options. To summarize, three courses of action would solve the issue:
My vote would be for Option 1. Leaner is better. What do you think? |
Sorry about the extremely slow response this time. |
Hi. It is good to have the option to exclude default attributes! I am looking for it too. |
Current default output includes
type
,size
, andextension
. It is impossible to remove these attributes, though they are cluttering the JSON since they are unnecessary for my purposes.By adding those three attributes to the call, it does the following:
extension
from filestype
from filestype
for directoriessize
for directoriessize
on filesThis is very inconsistent behavior so I'm unsure how to proceed.
Thanks in advance.
The text was updated successfully, but these errors were encountered: