front-matter-stream

0.2.1 • Public • Published

front-matter-stream

Stream a file and capture YAML front matter separately from content:

const fs = require('fs')
const fm = require('front-matter-stream')
 
var stream = fs.createReadStream('some-file.md')
  .pipe(fm())
  .on('frontmatter', function(data) {
    // handle your data here
  })
  .on('data', function() {
    // write or buffer your data here
  })
 
// or pipe just the content to another stream
stream.pipe(fs.createWriteStream('some-other-file.md'))
 
// or use concat-stream to collect the rest of the data
const concat = require('concat-stream')
stream.pipe(concat(function(content) {
  // content is Buffer here
}))

Installation

npm install --save front-matter-stream

Package Sidebar

Install

npm i front-matter-stream

Weekly Downloads

1

Version

0.2.1

License

CC0-1.0

Last publish

Collaborators

  • shawnbot