file-replace-stream
example
var fileReplaceStream = // ... a short time later aStreamOfSomethingImportant
Every time that aStreamOfSomethingImportant
emits, the contents of
tracking-file.txt
will be updated with the latest emission.
api
fileReplaceStream(filename) -> transformStream
- Writing to
transformStream
queues a write tofilename
. - Data writes will be dropped if they are superseded by others. In practice this should have no consequence.
- Writes are guaranteed to occur in order, so the latest data will always be
what is written to
filename
.
license
MIT