Nyota Drive
File & Folder Management
Listing, moving, renaming, and deleting objects.
Nyota Drive provides a traditional hierarchical filesystem overlay on top of flat S3 storage.
Listing Files
Fetch a paginated list of active files in your workspace. You can filter by folderId or applicationId.
// Fetch files at the root directory
const rootFiles = await drive.files.list();
// Fetch files inside a specific folder
const folderFiles = await drive.files.list({ folderId: "folder_123" });
// Fetch soft-deleted files in the Trash bin
const trashedFiles = await drive.files.list({ status: "deleted" });Moving and Renaming
You can rename a file or move it between folders instantly. This updates the logical database record and does not break existing public CDN URLs or secure Share links.
// Rename a file
await drive.files.rename("file_abc123", "v2-final-report.pdf");
// Move a file into a subfolder
await drive.files.move("file_abc123", "folder_xyz789");
// Move a file back to the root directory
await drive.files.move("file_abc123", null);Changing Visibility
Files can be transitioned between public and private states.
When a file is made public, Nyota seamlessly copies the physical object into our global CDN bucket.
const result = await drive.files.updateVisibility("file_abc123", "public");
// Returns the newly generated stable CDN URL
console.log(result.publicUrl);Deletion & Trash Bin
Deleting a file or folder moves it to the Trash bin. It will stop consuming your quota immediately, but it can be restored within 30 days.
// Move to trash
await drive.files.delete("file_abc123");
// Restore from trash
await drive.files.restore("file_abc123");
// Permanently purge from Cloudflare R2 immediately
await drive.files.forceDelete("file_abc123");