#directory #content #view #generate #hash #hash-tree

hashdir

Generate a cryptographic view of a directory's contents

4 releases

0.2.0 Feb 21, 2019
0.1.4 Feb 20, 2019
0.1.3 Feb 20, 2019
0.1.2 Feb 20, 2019

#15 in #hash-tree

MIT license

6KB
82 lines

hashdir

Build Status Crates.io Crates.io

Generate a cryptographic view of a directory's contents.

Usage

use hashdir::DirNode;

fn main() {
  let path = std::env::current_dir().unwrap();
  let node = DirNode::from_path(&path, &path).unwrap();
  println!("{:#?}", node);
}

JSON Output (with serde_json):

{
  "path": "./",
  "hash": "QZxKfmJir+ZeG3K2vNxQGgcSHjhsCroJuRGNZUth0HA=",
  "children": [
    {
      "path": "./lib.rs",
      "hash": "X65gIOpFCSJzOZTlKoSlPp2Zg02F8n6c6nYopAOXHcc=",
      "size": 3157
    },
    {
      "path": "./flat.json",
      "hash": "NAKMmbFrkytNFmsGz8pHuugiBY14DnjWGyBNwkUNR7A=",
      "size": 382
    }
  ]
}

Dependencies

~1.5–2.5MB
~53K SLoC