Skip to content

🎥 Make videos programmatically with React

write docs

Jonny Burger1ecf35309754
diff --git a/packages/docs/docs/get-static-files.md b/packages/docs/docs/get-static-files.md
new file mode 100644
index 0000000000..0ae1d5f69b
--- /dev/null
+++ b/packages/docs/docs/get-static-files.md
@@ -0,0 +1,45 @@
+---
+image: /generated/articles-docs-get-static-files.png
+id: getstaticfiles
+title: getStaticFiles()
+crumb: "API"
+---
+
+_Available from v3.3.7._
+
+Gets an array containing all files in the `public/` folder. You can reference them by using [`staticFile()`](/docs/staticfile).
+
+```tsx twoslash
+import { getStaticFiles, staticFile } from "remotion";
+
+const files = getStaticFiles();
+/*
+[
+ {
+ "path": "video.mp4",
+ "sizeInBytes": 432944,
+ "lastModified": 1670170466865
+ },
+ {
+ "path": "assets/data.json",
+ "sizeInBytes": 1311,
+ "lastModified": 1670170486089
+ },
+]
+*/
+
+const videoSrc = staticFile(files[0].path);
+```
+
+## API
+
+Takes no arguments and returns an array of object, each of which have three entries:
+
+- `path`: The path relative to the public folder. Contains forward slashes `/` even on Windows.
+- `sizeInBytes`: The file size. If it is a symbolic link, the file size of the original is reported.
+- `lastModified`: Last modified date in Unix timestamp in milliseconds.
+
+## See also
+
+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/core/src/get-static-files.ts)
+- [`staticFile()`](/docs/staticfile)
diff --git a/packages/docs/docs/staticfile.md b/packages/docs/docs/staticfile.md
index 770b976a4f..396d4891d3 100644
--- a/packages/docs/docs/staticfile.md
+++ b/packages/docs/docs/staticfile.md
@@ -73,3 +73,4 @@ You can achieve this via the browser-built-in `encodeURIComponent()` function: `
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/core/src/static-file.ts)
- [Loading assets](/docs/assets)
+- [`getStaticFiles()`](/docs/getstaticfiles)
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 06148f54ff..14489d3c5c 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -67,6 +67,7 @@ module.exports = {
"register-root",
"spring",
"staticfile",
+ "getstaticfiles",
"prefetch",
"audio",
"sequence",
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 6117dc0019..d9ade14e45 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -300,6 +300,13 @@ export const articles = [
compId: "articles-docs-get-input-props",
crumb: "API",
},
+ {
+ id: "getstaticfiles",
+ title: "getStaticFiles()",
+ relativePath: "docs/get-static-files.md",
+ compId: "articles-docs-get-static-files",
+ crumb: "API",
+ },
{
id: "get-video-metadata",
title: "getVideoMetadata()",