Skip to content

File information

getInfo in JavaScript and get_info in Python return an EntryInfo object. It contains the name, absolute path, type, size, permissions, owner, group, modification time, and symlink target.

mjs
import { Sandbox } from "@abox-dev/sdk";

const sandbox = await Sandbox.create();

try {
  await sandbox.files.write("/tmp/report.txt", "Quarterly report");

  const info = await sandbox.files.getInfo("/tmp/report.txt");
  console.log(info.name, info.type, info.size);

  const renamed = await sandbox.files.rename(
    "/tmp/report.txt",
    "/tmp/final-report.txt",
  );
  console.log(renamed.path);
} finally {
  await sandbox.kill();
}

The same information is returned by files.list for every directory entry. Use files.exists to check a path without raising a not-found error.