blobs

package module
v0.0.0-...-4a7348a Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2016 License: MIT Imports: 11 Imported by: 0

README

Blobs - Generate files of various size and content. Compatible with Go 1.6 and newer.

Build Status GoDoc Coverage Status Gitter Go Report Card

Sample Usage

Use Blobs to create files of various sizes in bytes, kilobytes, megabytes, and gigabytes. The next few examples demonstrate just how simple or specific creating blobs can be.

Create a 1MB file named 1.dat in the current directory with all 0s.

blobs

Create a 10MB file named 1.dat in the current directory with all random characters.

blobs --unit="10MB" --input-type="random"

Create two 20MB files named 1.txt and 2.txt in another directory with repeated content from stdin:

echo "foobarbaz" | blobs --unit="20MB" --amount=2 --dest="./scratch" --input-type="stdin" --o="%d.txt"

Create a randomized amount of 1KB files ranging from 1-1000 with random content in the current directory, all named (1-randomized amount).kb_file:

blobs --unit="1KB" --random=true --amount=1000 --input-type="random" --o="%d.kb_file"

Compete Usage Details

Blobs 1.0

 Usage: blobs <options> <options>...
  -amount int
    	Number of files to be created. (default 1)
  -dest string
    	Destination of created globs. (default "./")
  -help
    	Displays flag attributes & usage information.
  -input-type string
    	Specifies input type of blob content. stdin = stdin, random = random characters, zero = zero characters. (default "zero")
  -o string
    	Format specifier for blob file name. %d is for the number sequence of the file. (default "%d.dat")
  -random
    	Random number of blobs ranging from 1 to the value of the amount flag
  -unit string
    	Unit of space for the glob. (default "1MB")
Caveats

Comatability - This package is compatible with Go 1.6 onwards. There is a method in the math/rand package (rand.Read()) which is used as part of creating randomized blob content.

Stdin - Stdin will halt if the input type is set to "stdin" while there is nothing being piped. It will instead assume that there is data coming from the terminal, rather than being piped. This fix is on the roadmap.

TODOs
  • Tests, tests, and more tests
  • Error checking and handling for flags and other values
  • Improved configuration parsing

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mk

func Mk(r *Runner) error

Mk receives an instance of a Runner and creates blobs based on its attributes.

Types

type Runner

type Runner struct {
	Src       io.Reader
	Dest      string
	Amount    int
	Unit      string
	FormatStr string
	Content   []byte
	Random    bool
	InputType string
}

Runner contains information related to creating blobs.

func NewRunner

func NewRunner(src io.Reader, dst, unit, fmtStr string, amnt int, random bool, inputType string) *Runner

NewRunner returns a pointer to a Runner and initializes most of the fields with the given args.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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