-
Notifications
You must be signed in to change notification settings - Fork 0
Cloud
github-actions[bot] edited this page Jul 25, 2026
·
1 revision
The Cloud module gives you full access to EcoleDirecte's personal cloud storage.
Let's fetch the contents of the student's personal cloud and traverse the folder structure.
import { getCloud } from "linkdirecte";
// Retrieve the files and folders up to a depth of 3 folders deep
const cloudItems = await getCloud({ depth: 3 });
console.log(`You have ${cloudItems.length} top-level files or folders.`);
cloudItems.forEach(item => {
if (item.type === "folder") {
console.log(`📁 Folder: ${item.libelle} (contains ${item.children?.length ?? 0} items)`);
} else {
console.log(`📄 File: ${item.libelle} (${(item.taille / 1024).toFixed(1)} KB)`);
}
});Fetches all files and folders available in the student's personal space.
function getCloud(options?: GetCloudOptions): Promise<CloudEntry[]>-
options(optional):-
depth(number): How many folders deep the SDK should scan and build children arrays for. Defaults to3.
-
Creates a new folder under a parent directory.
function createFolder(
name: string,
parentNode: CloudNode,
): Promise<CloudNode>-
name(string): The name for your new folder. -
parentNode(CloudNode): The folder node where your new folder should be created.
import { getCloud, createFolder } from "linkdirecte";
const tree = await getCloud();
const myParentFolder = tree.find(node => node.type === "folder" && node.libelle === "My Documents");
if (myParentFolder) {
const newFolder = await createFolder("Math Homework", myParentFolder);
console.log(`Successfully created folder: ${newFolder.libelle}`);
}Moves files or folders to the Recycle Bin / Trash.
function deleteNodes(
nodes: CloudNode[],
): Promise<{ success: boolean }>-
nodes(CloudNode[]): An array of file or folder nodes to delete.
import { getCloud, deleteNodes } from "linkdirecte";
const tree = await getCloud();
const oldFile = tree.find(node => node.type === "file" && node.libelle === "temporary_draft.txt");
if (oldFile) {
const result = await deleteNodes([oldFile]);
if (result.success) {
console.log("File successfully moved to trash!");
}
}Represents either a folder or a file inside the EcoleDirecte cloud:
interface CloudNode {
id: string; // Unique string ID of the file or folder
type: "file" | "folder"; // Node type
libelle: string; // Name of the file or folder (raw key)
date: string; // Date string when created or updated
taille: number; // File size in bytes (raw key)
readonly: boolean; // True if the node is write-protected (raw key)
hidden: boolean; // True if the item is hidden (raw key)
isTrash: boolean; // True if the item is currently in the trash
isLoaded?: boolean; // Indicates if subfolders have been loaded
quota?: number; // Space limit in bytes (usually present on top folder)
displayText?: string; // Friendly display string
children?: CloudNode[]; // Child nodes (if a folder)
proprietaire?: { // Owner metadata object (raw key)
id: number;
type: string;
nom: string;
prenom: string;
particule: string;
};
}A simple union representing the entries returned:
type CloudEntry = CloudFolderNode | CloudFileNode;
interface CloudFolderNode extends CloudNode {
type: "folder";
children: CloudNode[];
}
interface CloudFileNode extends CloudNode {
type: "file";
}© 2026 typeof (Scolup) | Licensed under AGPL 3.0