GET
/
boxes
/
{boxId}
/
fs
/
info
JavaScript
import GboxSDK, { isFileOperator } from "gbox-sdk";

const gboxSDK = new GboxSDK({
  apiKey: process.env["GBOX_API_KEY"] // This is the default and can be omitted
});

async function main() {
  const box = await gboxSDK.create({ type: "linux" });

  const file = await box.fs.get({
    path: "/home/user/example.txt"
  });

  if (isFileOperator(file)) {
    const content = await file.read();
    console.info(`📄 ${file.name} (${file.size}) - ${file.path}`);
    console.info(`content: ${content.data}`);
  } else {
    console.info(`📁 ${file.name} - ${file.path} is a directory`);
  }
}

main();
{
  "type": "file",
  "name": "example.txt",
  "path": "/path/to/example.txt",
  "size": "10MB",
  "mode": "755",
  "lastModified": "2021-01-01T00:00:00Z"
}

Authorizations

Authorization
string
header
required

Enter your API Key in the format: Bearer <token>. Get it from https://gbox.ai

Path Parameters

boxId
string
required

Box ID

Example:

"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"

Query Parameters

workingDir
string

Working directory. If not provided, the file will be read from the box.config.workingDir directory.

Example:

"/home/user/documents"

path
string
required

Target path in the box. If the path does not start with '/', the file/directory will be checked relative to the working directory

Example:

"/home/user/documents/output.txt"

Response

200
application/json

Get file/dir

File system file representation