mihneadb / node-directory-tree

Convert a directory tree to a JS object.
MIT License
523 stars 106 forks source link

Handle permission errors #33

Open GhyslainBruno opened 7 years ago

GhyslainBruno commented 7 years ago

Hi guys,

First of all thank you for your job, I currently am using your library and it's pretty powerfull.

I'm just wondering if there would be a way to handle permission errors with it ? (would be awesome)

Thanks for your reply,

Cheers !

mihnea-dobrescubalaur-hs commented 7 years ago

Hi! Glad it's useful! The code currently skips files without permission (https://github.com/mihneadb/node-directory-tree/blob/master/lib/directory-tree.js#L15). One option would be to add a callback like onError and leave the user to deal with that error. However, I'm wondering - how would you handle a permissions error?