hashdir

package module
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2022 License: MIT Imports: 11 Imported by: 1

README

hashdir

A simple tool to calculate the hash of a directory. Only considering it's contents, ignoring all attributes.

Basically a copy of https://github.com/gosimple/hashdir with some improvements, bug fixes & a CLI tool to wrap the library.

CLI Usage

Install the cli tool by downloading the appropriate binary / archive from https://github.com/brad-jones/hashdir/releases

Alternative installation methods:

  • HomeBrew: brew install brad-jones/tap/hashdir
  • Scoop: scoop bucket add brad-jones https://github.com/brad-jones/scoop-bucket.git; scoop install hashdir;
  • Docker: docker pull ghcr.io/brad-jones/hashdir/cli:latest

Then just execute hashdir with a path and an optional hash algorithm (defaults to sha256).

hashdir [-alg md5|sha1|sha256|sha512] /a/path

The hash will be output as a hex encoded string, with no other output, not even a newline.

TIP: A docker run command might look like: docker run --rm -v /a/path:/a/path ghcr.io/brad-jones/hashdir/cli:latest /a/path

Library Usage

Consume the go module like any other.

package main

import (
  "github.com/brad-jones/hashdir"
)

func main() {
  hash, err := hashdir.Make("/a/path", "md5|sha1|sha256|sha512")
  if err != nil {
    panic(err)
  }

  // do something with "hash"...
}

Documentation

Overview

Package hashdir, originally built by https://github.com/gosimple/hashdir

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Make

func Make(dir string, hashType string) (string, error)

Make generate hash of all files and they paths for specified directory.

Types

This section is empty.

Directories

Path Synopsis
cmd module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL