[CentOS] caching pipe?

Sat Sep 5 12:28:58 UTC 2009
Michael Kralka <michael.kralka at gmail.com>

On 2009-09-05, at 2:32 AM, Florin Andrei <florin at andrei.myip.org> wrote:

> Is it possible to add caching to a pipe?
>
> cat blah | in_RAM_cache_here -s SIZE | something else
<snip>

I beleive dd does what you want.

> (*) - it's actually tccat, part of the transcode package, but the idea
> is the same. Here's the actual command:
>
> n=14
> for i in `seq -w 1 ${n}`; do
>    echo "${i} out of ${n}"
>    tccat -i /dev/dvd -T 1,${i} > ch${i}.mpeg
> done
> sync
> ls -lh


tccat -i /dev/dvd -T 1,${i} | dd of=ch${i}.mpeg bs=1M

will read 1 MiB blocks, one at a time from tccat then write it to the  
file. I'm fairly certain that it doesn't write any data until either  
there is no more data to read or it has read a complete block.

Michael