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. In the Player, events will never fire.
Example
import { StaticFile , watchPublicFolder } from "@remotion/studio";
// Watch for changes in a specific static file
const { cancel } = watchPublicFolder ((newFiles : StaticFile []) => {
console .log ("The public folder now contains:", newFiles );
});
// To stop watching for changes, call the cancel function
cancel ();Arguments
Takes one argument and returns a function that can be used to cancel 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.