-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# ScanDir.jl | ||
|
||
*Faster reading of directories* | ||
|
||
This package provides two functions: | ||
- `scandir`, which returns a vector of `DirEntry` objects, each specifying a filename and a type (file, directory, link etc.). | ||
- `ScanDir.walkdir`, which is a faster version of `Base.walkdir`, using `scandir` to avoid unnecessary `stat` calls. | ||
|
||
Julia's builtin `readdir` function returns filenames in a directory but discards the type information returned from the underlying `libuv` function call. | ||
The `scandir` function exposes this information in the `DirEntry` struct. | ||
The name `scandir` was chosen to parallel python's `os.scandir`, which offers similar functionality. | ||
|
||
Benchmarks of `ScanDir.walkdir` on one Windows machine have shown a speedup factor of 4\~4.5 on a local drive, and 30\~35 (!) on a network-mapped drive, compared to `Base.walkdir`. | ||
|
||
|
||
## Usage | ||
`scandir(path::AbstractString=".")` returns a vector of `DirEntry`. | ||
Each `DirEntry`'s filename is accessible via the a `name` field. | ||
Its type can be queried by the standard `Base` functions (`isfile`, `isdir`, `islink`, `isfifo`, `issocket`, `ischardev`, `isblockdev`). | ||
|
||
`ScanDir.walkdir` is a faster implementation of `Base.walkdir` (https://docs.julialang.org/en/v1/base/file/#Base.Filesystem.walkdir), and has the same interface. | ||
|
4b79b04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
4b79b04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/6453
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via: