Pipe filenames in, get contents out.
Want to see pretty graphs? Log in now!
npm install catstream
|6||downloads in the last week|
|21||downloads in the last month|
|Last Published By|
|Version||1.0.2 last updated 10 months ago|
|Keywords||stream, stream2, concatenate, multifile, cat|
Filenames go in, contents come out. You can't explain that.
npm install --save catstream
catstream is a Transform stream that takes filenames as inputs and outputs the contents of said filenames in the order they were read.
var filenames = [ 'a.txt', // content: hello 'b.txt', // content: goodbye 'c.txt' // content: o rly ]; var cat = require('catstream'); var c = cat() cat.pipe(process.stdout) cat.end(filenames.join('\n')) // prints "hello goodbye o rly" to the console
more usually you have a readable stream with a list of filenames that you pipe to this.
new CatStream([transformer], [options])
Creates a new cat stream.
transformeris a function that returns a transform stream. Each time a new file is read and when
transformeris defined, the content of the file is piped through the transform stream.
optionsa configuration object for the transform stream. The default options for transform streams are applicable and the following is added:
separatorthe separator between filenames in the input. defaults to newline.
Copyright (c) 2013 Florent Jaby
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.