We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would be cool if there were an method like this:
fs.createReadStream('file.html') .pipe(frontMatter.stream(function(attributes, stream) { console.log(attributes) stream.pipe(fs.createWriteStream('withoutyml.html')) })
The text was updated successfully, but these errors were encountered:
This is a great idea, I don't think it would be that hard to implement either.
What do you think of having a normal stream signature and emitting the attributes, maybe something like:
var fm = require('front-matter') var stream = fm.createStream() stream.on('attributes', function(attributes) { console.log(attributes) }) fs.createReadStream('my-file.html') .pipe(stream) .pipe(fs.createWriteStream('withoutyml.html'))
Sorry, something went wrong.
Your API was my first idea, but I think often you want to use the attributes to change the stream flow. Like in this example:
var fm = require('front-matter') var stream = fm.createStream() fs.createReadStream('my-file.html') .pipe(stream(function(attributes, stream) { (attributes.markdown ? stream.pipe(markdown2html()) : stream) .pipe(fs.createWriteStream('withoutyml.html')) })
Alternatively maybe there could be a callback that you can pass a transform stream:
var stream = fm.createStream(function(attributes, cb) { if(attributes.markdown) cb(null, markdown2html()) else cb() }) fs.createReadStream('my-file.html') .pipe(stream) .pipe(fs.createWriteStream('withoutyml.html'))
But I feel like the first solution is easier. What do you think?
No branches or pull requests
Would be cool if there were an method like this:
The text was updated successfully, but these errors were encountered: