pmc 2.0.0

PMC is a simple and easy to use PM2 alternative
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use macros_rs::crashln;
use merkle_hash::{bytes_to_hex, Algorithm, MerkleTree};
use std::path::PathBuf;

pub fn create(path: PathBuf) -> String {
    log::info!("creating hash for {:?}", path);
    let tree = match MerkleTree::builder(&path.to_str().unwrap()).algorithm(Algorithm::Blake3).hash_names(false).build() {
        Ok(v) => v,
        // fix issue on post /daemon/create
        Err(e) => crashln!("Invalid UTF-8 sequence: {}", e),
    };

    log::trace!("hash {:?}", tree.root.item.hash);
    bytes_to_hex(tree.root.item.hash)
}