Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yha authored Dec 9, 2019
1 parent 5e60060 commit 4b79b04
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
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.

2 comments on commit 4b79b04

@yha
Copy link
Owner Author

@yha yha commented on 4b79b04 Dec 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

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:

git tag -a v0.1.0 -m "<description of version>" 4b79b04793ed6de70f823553982951eee49c19af
git push origin v0.1.0

Please sign in to comment.