Code Monkey home page Code Monkey logo

jwalk's Introduction

jwalk

Filesystem walk.

  • Performed in parallel using rayon
  • Entries streamed in sorted order
  • Custom sort/filter/skip/state

Build Status Latest version

Usage

Add this to your Cargo.toml:

[dependencies]
jwalk = "0.5"

Lean More: docs.rs/jwalk

Example

Recursively iterate over the "foo" directory sorting by name:

use jwalk::{WalkDir};

for entry in WalkDir::new("foo").sort(true) {
  println!("{}", entry?.path().display());
}

Inspiration

This crate is inspired by both walkdir and ignore. It attempts to combine the parallelism of ignore with walkdir's streaming iterator API. Some code and comments are copied directly from walkdir.

Why use this crate?

This crate is particularly good when you want streamed sorted results. In my tests it's about 4x walkdir speed for sorted results with metadata. Also this crate's process_read_dir callback allows you to arbitrarily sort/filter/skip/state entries before they are yielded.

Why not use this crate?

Directory traversal is already pretty fast. If you don't need this crate's speed then walkdir provides a smaller and more tested single threaded implementation.

This crates parallelism happens at the directory level. It will help when walking deep file systems with many directories. It wont help when reading a single directory with many files.

Benchmarks

Benchmarks comparing this crate with walkdir and ignore.

jwalk's People

Contributors

jessegrosjean avatar byron avatar brmmm3 avatar vks avatar bootandy avatar ignatenkobrain avatar jules-sommer avatar spacekookie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.