Code Monkey home page Code Monkey logo

stdin2file's Introduction

stdin2file

A kind of tee-like program which writes stdin to file, and optionally compresses it using multiple threads.

Installation

Archives of precompiled binaries are available for Linux.

Other way is to clone project and compile it yourself.

Usage

stdin2file 1.2
hugruu <[email protected]>
Write from stdin to file(s), optionally compresses it using given algorithm

USAGE:
    stdin2file [OPTIONS] --chunk <chunk> --output <output>

OPTIONS:
    -c, --chunk <chunk>            Maximum size of single file size [MB]
    -e, --execute <execute>        Command to execute (instead of stdin) - CURRENTLY UNSUPPORTED
    -h, --help                     Print help information
    -m, --max-files <max-files>    Number of rotated files
    -o, --output <output>          Output file
    -s, --compress <compress>      Compression algorithm [possible values: xz, gz]
    -V, --version                  Print version information

Examples

Copy stdin to 5 rotating files, each 1 MB before compression, and compress them:

command | stdin2file -c 1 -m 5 -o test -s xz

Split 10 MiB text file using above settings:

base64 /dev/urandom | head -c 10000000 | stdin2file -c 1 -m 5 -o test -s xz

This will result in 5 files:

$ ls -la
total 3600
-rw-rw-r-- 1 gruszeck gruszeck 806680 Feb  5 18:14 test.5.xz
-rw-rw-r-- 1 gruszeck gruszeck 806532 Feb  5 18:14 test.6.xz
-rw-rw-r-- 1 gruszeck gruszeck 806952 Feb  5 18:14 test.7.xz
-rw-rw-r-- 1 gruszeck gruszeck 806504 Feb  5 18:14 test.8.xz
-rw-rw-r-- 1 gruszeck gruszeck 433092 Feb  5 18:14 test.9.xz

Possible improvements

  • Add support for lzma, gzip or other algorithms
  • Pass command as argument instead of pipe
  • Add pipeline

License

https://en.wikipedia.org/wiki/WTFPL.

stdin2file's People

Contributors

hubcio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.