Git Product home page Git Product logo

node-growing-file's Introduction

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,
    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.

node-growing-file's People

Contributors

felixge avatar kpapadatos avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.