Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/felixge/node-growing-file
A readable file stream for files that are growing.
https://github.com/felixge/node-growing-file
Last synced: about 2 months ago
JSON representation
A readable file stream for files that are growing.
- Host: GitHub
- URL: https://github.com/felixge/node-growing-file
- Owner: felixge
- Created: 2011-04-05T15:44:29.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2016-11-21T07:34:12.000Z (about 8 years ago)
- Last Synced: 2024-10-11T15:18:48.860Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 106
- Watchers: 8
- Forks: 15
- Open Issues: 8
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# 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
```js
var file = GrowingFile.open('my-growing-file.dat');
file.pipe();
```**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.
```js
var file = GrowingFile.open(path, options);
```Where `options` defaults to:
```js
{
timeout: 3000,
interval: 100,
startFromEnd: false
}
```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.
* `startFromEnd` starts the read stream from the currently last byte.## License
Written by Felix Geisendörfer, licensed under the MIT license.