packages/docs/docs/studio/watch-public-folder.mdx
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. :::
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();
Takes one argument and returns a function that can be used to cancel the event listener.
callbackA callback function that will be called when the directory is modified. As an argument, an array of StaticFile's is passed.