Skip to main content
You can use the files.getInfo() / files.get_info() method to retrieve metadata about a file or directory. It returns details such as the filename, type, and path.

Getting metadata about a file

import { Sandbox } from 'novita-sandbox/code-interpreter'

const sandbox = await Sandbox.create()

// Create test file
const filePathInSandbox = '/tmp/test-file'
await sandbox.files.write(filePathInSandbox, 'test-file-content')

// Get file metadata
const info = await sandbox.files.getInfo(filePathInSandbox)
console.log(info)
// {
//   name: 'test-file',
//   type: 'file',
//   path: '/tmp/test-file',
//   size: 17,
//   mode: 420,
//   permissions: '-rw-r--r--',
//   owner: 'user',
//   group: 'user',
//   modifiedTime: 2026-06-03T12:12:23.964Z,
//   symlinkTarget: undefined
// }

await sandbox.kill()

Getting metadata about a directory

import { Sandbox } from 'novita-sandbox/code-interpreter'

const sandbox = await Sandbox.create()

// Create test directory
const dirPathInSandbox = '/tmp/test-dir'
await sandbox.files.makeDir(dirPathInSandbox)

// Get directory metadata
const info = await sandbox.files.getInfo(dirPathInSandbox)
console.log(info)
// {
//   name: 'test-dir',
//   type: 'dir',
//   path: '/tmp/test-dir',
//   size: 40,
//   mode: 493,
//   permissions: 'drwxr-xr-x',
//   owner: 'user',
//   group: 'user',
//   modifiedTime: 2026-06-03T12:13:59.194Z,
//   symlinkTarget: undefined
// }

await sandbox.kill()
Last modified on June 4, 2026