deleteStaticFile()v4.0.154
Deletes a file from the public
directory.
This API is useful for building interactive experiences in the Remotion Studio.
Examples
Delete 'video.webm'tsx
importReact , {useCallback } from "react";import {deleteStaticFile } from "@remotion/studio";export constDeleteStaticFileComp :React .FC = () => {constdeleteFile =useCallback (async () => {const {existed } = awaitdeleteStaticFile ("video.webm");console .log (`Deleted file (${existed ? "existed" : "did not exist"})`);}, []);return <button onClick ={deleteFile }>Delete</button >;};
Delete 'video.webm'tsx
importReact , {useCallback } from "react";import {deleteStaticFile } from "@remotion/studio";export constDeleteStaticFileComp :React .FC = () => {constdeleteFile =useCallback (async () => {const {existed } = awaitdeleteStaticFile ("video.webm");console .log (`Deleted file (${existed ? "existed" : "did not exist"})`);}, []);return <button onClick ={deleteFile }>Delete</button >;};
Rules
1 This API can only be used while in the Remotion Studio.
2 The file path must be relative to the
public
directory
.
3 It's not allowed to delete a file outside the
public
directory
.
4 To delete a file in a subfolder, use forward slashes
/
even on Windows.
5 You can, but don't have to wrap the file path in a
staticFile()
function.