@escio/stream-buffer-until-end

1.0.2 • Public • Published

@escio/stream-buffer-until-end

Duplex object stream buffering data until end of the stream and then letting all though.

This is useful for cases where you want to wait for the part of a stream pipeline to clear before passing data on to the rest of the pipeline.

Installation

$ npm install @escio/stream-buffer-until-end

Usage

The most common use-case is in a gulp pipeline where you want to wait until all files have been written to disk before triggering a livereload, or similar.

const gulp = require('gulp');
const livereload = require('gulp-livereload')
const bufferUntilEnd = require('@escio/stream-buffer-until-end');

gulp.task('build', () => gulp.src(
    'sourceFiles'
).pipe(
    ...transform data...
).pipe(
    gulp.dest('targetDirectory')
).pipe(
    // No files will pass this point until the gulp.dest stream is done
    // writing to disk and sends the end signal...
    bufferUntilEnd()
).pipe(
    livereload()
);

License

ISC © Escio AS

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.21latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.21
1.0.10
1.0.00

Package Sidebar

Install

npm i @escio/stream-buffer-until-end

Weekly Downloads

1

Version

1.0.2

License

ISC

Last publish

Collaborators

  • wien
  • joakimescio
  • sanders54