@bitbeater/node-utils - v3.0.0
    Preparing search index...

    Function tailStream

    • Creates a readable stream that tails a file, emitting new data as it is appended.

      Parameters

      • filePath: string

      Returns [ReadableStream<Uint8Array<ArrayBufferLike>>, () => void]

      A tuple containing the readable stream and a cancel function to stop tailing the file.

      const [readableTailStream, stopTailFn] = tailStream('path/to/file.txt');
      for await (const chunk of readableTailStream) {
      console.log('New data appended:', Buffer.from(chunk).toString());
      }

      // To stop tailing the file, call the stopTailFn() function