https://github.com/techjacker/randomfs
Random data file generator. Quickly create test fixtures.
https://github.com/techjacker/randomfs
Last synced: 12 months ago
JSON representation
Random data file generator. Quickly create test fixtures.
- Host: GitHub
- URL: https://github.com/techjacker/randomfs
- Owner: techjacker
- License: mit
- Created: 2016-07-05T21:04:58.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-15T12:43:28.000Z (over 9 years ago)
- Last Synced: 2025-02-09T13:36:57.838Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# randomfs
Generates x files with random data.
Options:
- specify exact content in files
- repeat exact content at certain frequencies (eg every 10th file created)
- specify max length of data in files
-----------------------------------------------------------
## Install
### Binary
[Download](../../releases) the latest stable release.
### Source
```
go get -u github.com/techjacker/randomfs
```
-----------------------------------------------------------
## Usage
```Shell
Usage: randomfs [options]
Eg: randomfs 100
-freq int
frequency of the repeat text, eg every 5 files (default 5)
-location string
the location to put the files (default "/Users/andy/go/src/github.com/techjacker/randomfs")
-max int
the max number of characters per file (default 512)
-prev int
how often to repeat the content of all the previous files (default 11)
-repeat string
the repeat text (default "repeat_text")
```
-----------------------------------------------------------
## Tests
```Shell
go test
```
-----------------------------------------------------------
### Docker Example
Generates 100 files with random data.
1. Every 5th file contains "Nothing to see here"
2. Every 11th file contains the contents of all previous files
3. Random data files not exceed 512 characters in text
#### Build
```Shell
docker build -t randomfs/golang .
```
#### Run
```Shell
docker run -it --name randomfs_golang randomfs/golang /bin/bash
app -location /home 100
cd /home
ls -l /home
# random data
cat -v 000
# Every 5th file should contain "repeat_text"
cat -v 004
# Every 11th file should contain the contents of all previous files.
cat -v 010
# Every 11th file should contain the contents of all previous files.
# But capped at 512 characters
cat -v 098
```