growing-file

0.1.3 • Public • Published

node-growing-file

Purpose

Sometimes you need to read from a file that is still being written to by another process. This library provides a readable stream that keeps reading until the file has been idle for a certain time.

Current status

This module is still fresh. Try it while it's hot.

Installation

npm install growing-file

Usage

var file = GrowingFile.open('my-growing-file.dat');
file.pipe(<some writeable stream>);

Note: The file does not have to exist yet when invoking this method. An 'error' event is emitted if it is not created within the configured timeout.

Options

GrowingFile.create accepts an options array.

var file = GrowingFile.open(path, options);

Where options defaults to:

{
  timeout: 3000,
  interval: 100,
}

Time values are given in ms.

  • timeout determines after what time a file is considered to be done growing.
  • interval specifies the frequency at which the file is being polled for changes.

License

Written by Felix Geisendörfer, licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i growing-file

Weekly Downloads

71

Version

0.1.3

License

none

Last publish

Collaborators

  • felixge
  • vinayh