Skip to content

Feature request event when awaitWriteFinish is waiting #1444

@Maescool

Description

@Maescool

Can we have an event whenever awaitWriteFinish is triggered, and it is awaiting for a path
We know it's done whenever any of the other events trigger.

Alternative proposal, have a call where we can check if it's still waiting for something to finish?

Use case example:
Save file -> chokidar add/change event -> our code updates a sha of the file in a cache -> we hand trigger processing of the watched files

Problem is:
When we hand trigger before the add/change event is triggered, our hand trigger has out of date sha in it's cache.
So the hand trigger doesn't know chokidar is still awaiting writes.

Possible solutions:

  • event when it's awaiting a path, then you know it's done when the other event (add/change/delete/etc) is called.
  • a call to chokidar to check if it's still awaiting any changes to finish. or a blocking call to wait for it to finish. (however these options can be self implemented with the previous solution available)
  • or we don't use awaitWriteFinish, and handle all the events with some timeout to make sure all the file-save changes are done, but this is spamming a lot of events on big files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions