Documentation Index
Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
Use this file to discover all available pages before exploring further.
Getting a list of files
application.files.list() return a list of APIListedFile objects.
const application = await api.applications.get("Application ID");
const filesList = await application.files.list();
console.log(filesList); // Return a Array of File Objects
// [{type: "file", name: "index.js", size: 123, lastModified: 123456789}]
Reading a file
application.files.read() returns a Buffer object.
const application = await api.applications.get("Application ID");
const file = await application.files.read("index.js");
console.log(file.toString()); // String
Creating a file
application.files.create() returns a Boolean.
Using Buffer
Using Absolute Path
const { SquareCloudAPI } = require("@squarecloud/api");
const api = new SquareCloudAPI("Your API Key");
const application = await api.applications.get("Application ID");
// Specify the content and name of the file you want to create
const fileContent = Buffer.from("archive content here");
const filePath = "./folder/test_file.txt";
// Perform the create file operation
const file = await application.files.create(fileContent, filePath);
console.log(file); // Boolean (true or false)
const { SquareCloudAPI } = require("@squarecloud/api");
const api = new SquareCloudAPI("Your API Key");
const application = await api.applications.get("Application ID");
// Specify the content and name of the file you want to create
const { join } = require("node:path");
const fileName = "local_txt_file.txt";
const fileContent = join(__dirname, fileName);
const filePathtoCreate = "./folder/test_file.txt";
// Perform the create file operation
const file = await application.files.create(fileContent, filePathtoCreate);
console.log(file); // Boolean (true or false)
Deleting a file
application.files.delete() returns a Boolean.
const application = await api.applications.get("Application ID");
const deleted = await application.files.delete("index.js");
console.log(deleted); // Boolean (true or false)