fs#unwatchFile TypeScript Examples

The following examples show how to use fs#unwatchFile. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LogWatcher.ts    From awakened-poe-trade with MIT License 6 votes vote down vote up
static async watch (path: string) {
    if (this.file) {
      unwatchFile(this.filePath!)
      await this.file.close()
      this.file = undefined
      this.isReading = false
    }

    watchFile(path, { interval: 450 }, () => {
      this.handleFileChange()
    })
    this.filePath = path

    this.file = await fs.open(path, 'r')
    const stats = await this.file.stat()
    this.offset = stats.size
  }