build-utils/grunt-tasks/changelog-custom.js
function appendLogToFileStream(fileName, newLog, headerLineCount) {
    const filePath = path.join(__dirname, '../../', fileName)
    const oldChangelog = grunt.file.read(filePath)
      .toString()
      .split('\n');

    let wStr = fs.createWriteStream(filePath)
    /** lines used by the default header */
    let logHeader = oldChangelog.slice(0, headerLineCount);
    /** previous changelog entries */
    let prevLogs = oldChangelog.slice(headerLineCount);
    var s = new Readable;
    s.pipe(wStr);
    s.push(logHeader.join('\n') + '\n');
    s.push(newLog);
    s.push(prevLogs.join('\n'));
    s.push(null); // indicates end-of-file basically - the end of the stream)
    return wStr;
  }
function appendLogToFileStream(fileName, newLog, headerLineCount) {
    const filePath = path.join(__dirname, '../../', fileName)
    const oldChangelog = grunt.file.read(filePath)
      .toString()
      .split('\n');

    let wStr = fs.createWriteStream(filePath)
    /** lines used by the default header */
    let logHeader = oldChangelog.slice(0, headerLineCount);
    /** previous changelog entries */
    let prevLogs = oldChangelog.slice(headerLineCount);
    var s = new Readable;
    s.pipe(wStr);
    s.push(logHeader.join('\n') + '\n');
    s.push(newLog);
    s.push(prevLogs.join('\n'));
    s.push(null); // indicates end-of-file basically - the end of the stream)
    return wStr;
  }
Writes a log to a file
@param  {string} fileName  filename/path to write to
@param  {string} newLog  new Changelog entry to add
@param  {number} headerLineCount  Number of lines the header occupies