The useWatchTextFile()
hook allows you to read and write to the contents of a file at the provided filePath
.
Property | Type | Description |
---|---|---|
status | UseWatchTextFileStatus | The file watcher’s status. Useful for ensuring the desired file is being watched. |
content | string | null | If watching, the contents of the file located at the provided filePath |
watchError | string | null | If an error occurs, the corresponding error message |
writeChange | WriteChange | null | If watching, a function to update the watched file |
Property | Type |
---|---|
from | number |
to? | number |
insert? | string |
Property | Type |
---|---|
status | UseWatchTextFileStatus.Error | UseWatchTextFileStatus.Moved | UseWatchTextFileStatus.Deleted |
content | null |
watchError | string | null |
writeChange | null |
Property | Type |
---|---|
status | UseWatchTextFileStatus.Loading |
content | null |
watchError | null |
writeChange | null |
Property | Type |
---|---|
status | UseWatchTextFileStatus.Watching |
content | string |
watchError | null |
writeChange | WriteChange |