Capítulo 373 de 988

Chapter 373: writeStaticFile()

Core Idea

Saves some content into a file in the public directory. This API is useful for building interactive experiences in the Remotion Studio.

Key Concepts

  • Examples
  • Rules
  • See also

Code Examples

export const WriteStaticFileComp: React.FC = () => {
  const saveFile = useCallback(async () => {
    await writeStaticFile({
      filePath: "file.txt",
      contents: "Hello world",
    });

    console.log("Saved!");
  }, []);

  return <button onClick={saveFile}>Save</button>;
};
  • What it demonstrates: Usage pattern for writeStaticFile() from the official docs.

Key Takeaways

  1. Understand examples when working with writeStaticFile().
  2. Understand rules when working with writeStaticFile().
  3. Understand see also when working with writeStaticFile().

Connects To

  • Clipper: related page in the Studio, Player & Editing section.
  • Design Systems: related page in the Studio, Player & Editing section.
  • Editor Starter: related page in the Studio, Player & Editing section.