watchPublicFolder()v4.0.154
Watches for changes in the public directory and calls a callback function when a file is added, removed or modified.
note
This feature is only available within the Remotion Studio environment. Outside the Studio, it logs a warning and returns a no-op cancel() function. In a read-only Studio other than remotion.new, it throws an error.
Example
example.tsximport {StaticFile ,watchPublicFolder } from "@remotion/studio"; // Watch for changes in the public folder const {cancel } =watchPublicFolder ((newFiles :StaticFile []) => {console .log ("The public folder now contains:",newFiles ); }); // To stop watching for changes, call the cancel functioncancel ();
Arguments
Takes one argument and returns an object with a cancel() function that removes the event listener.
callback
A callback function that will be called when the directory is modified. As an argument, an array of StaticFile's is passed.
Compatibility
| Browsers | Environments | |||||
|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | ||||
Editable Studio | ||||||