Skip to content

followSymlinks option #11

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

Merged
merged 7 commits into from
Dec 2, 2018
Merged

followSymlinks option #11

merged 7 commits into from
Dec 2, 2018

Conversation

amercier
Copy link
Owner

@amercier amercier commented Dec 1, 2018

options.followSymlinks (default: false)

When set to true, resolves any symbolic link to the directory it's pointing to, while preserving the link's path.

# Directory structure:
level1
├── level2
│   ├── file2a
│   └── file2b
├── file1a
├── link-to-directory -> level2
└── link-to-file -> file1a
for await (const files of filesByDirectory(['level1']/*, { followSymlinks: false }*/} )) {
  console.log(files);
}
// [ 'level1/file1a', 'level1/link-to-directory', 'link-to-file' ]
// [ 'level1/level2/file2a', 'level1/level2/file2b' ]

for await (const files of filesByDirectory(['level1'], { followSymlinks: true })) {
  console.log(files);
}
// [ 'level1/file1a', 'level1/link-to-file' ]
// [ 'level1/level2/file2a', 'level1/level2/file2b' ]
// [ 'level1/link-to-directory/file2a', 'level1/link-to-directory/file2b' ]

@amercier amercier merged commit 46bd768 into master Dec 2, 2018
@amercier amercier deleted the follow-symlinks branch December 2, 2018 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant