
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
tail-follow
Advanced tools
Stream a file in real time as it grows.
If you are familiar with UNIX's tail -f, you have a good idea what this module does. It provides a Readable stream interface to a file that emits new data appended to the file in real time. It can even do the equivalent of tail -F, to survive log rotation.
There are a lot of tail modules on npm, but this one differentiates itself by:
Readable stream, so your data event listeners get Buffer objects instead of decoded strings split by lines.rename event when the underlying file is renamed or rotated.var TailFollow = require("tail-follow")
TailFollow(path, [options])Create new TailFollow instance, for the file at the given path. This is a Readable stream, so you should listen for the error event and data event. Or pipe() it to another stream.
The optional arguments object takes the same parameters as a Readable stream (encoding and highWaterMark), plus the following:
tailChunkSize: Sets the size in bytes of Buffer objects created when reading from the file. Too small of a value, you will spend too much CPU handling new chunks; too big of a value, and you will waste memory. The default is 16384.surviveRotation: Set to true so that if the underlying file is renamed or deleted, data will continue to be read from a new file created at the same path. Think tail -F. The default is false.objectMode: Setting to true enables object mode like on any other Readable stream, but has a few side effects. It enables position tracking so that you may call .positionForChunk() to determine where in the file a chunk of data was read from. If you have enabled decoding (via the encoding option), note that this will also cause your data events to emit String instances (as opposed to string primitives).follow: Default true. Setting to false will cause the stream to close when it reaches the end of the file instead of continuing to follow it.fileRenamePollingInterval: Default is null. Setting this to a number will cause TailFollow to poll for file rename events every given number of milliseconds instead of relying on fs.watch() rename events. Try this if your tail sometimes stops after a rotation.renameEmitted when the underlying file has been renamed. The first argument sent to the event handler is the old file path, the second is the new file path. Currently, this is limited to moves within the same directory, or within sibling directories of the file.
unfollow()Stops following the file and ends the stream.
positionForChunk(chunk)Returns the number of bytes from the beginning of the file that the chunk starts at. This must be the same object that was emitted to your data event handler. The stream must also be in objectMode. (See the documentation for the objectMode constructor option.)
setTailChunkSize(size)See the documentation for the tailChunkSize constructor option above.
setSurviveRotation(bool)See the documentation for the surviveRotation constructor option above.
setFileRenamePollingInterval(milliseconds)See the documentation for the fileRenamePollingInterval constructor option above.
filePathConvenience property to get the full path of the file that the instance is following.
Run node with DEBUG=tail-follow.
This module uses ES2015. To compile the source to ES5 (compatible with Node.js, io.js), run npm run compile.
Any changes in behavior need test coverage. To run the tests, run npm test.
FAQs
Stream a file in real time as it grows
We found that tail-follow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.