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()
from novita_sandbox.code_interpreter import Sandbox
sandbox = Sandbox.create()
# Create test file
file_path_in_sandbox = '/tmp/test-file'
sandbox.files.write(file_path_in_sandbox, 'test-file-content')
# Get file metadata
info = sandbox.files.get_info(file_path_in_sandbox)
print(info)
# EntryInfo(
# name='test-file',
# type=<FileType.FILE: 'file'>,
# path='/tmp/test-file',
# size=17,
# mode=420,
# permissions='-rw-r--r--',
# owner='user',
# group='user',
# modified_time=datetime.datetime(2026, 6, 3, 12, 14, 34, 745328),
# symlink_target=None
# )
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()
from novita_sandbox.code_interpreter import Sandbox
sandbox = Sandbox.create()
# Create test directory
dir_path_in_sandbox = '/tmp/test-dir'
sandbox.files.make_dir(dir_path_in_sandbox)
# Get directory metadata
info = sandbox.files.get_info(dir_path_in_sandbox)
print(info)
# EntryInfo(
# name='test-dir',
# type=<FileType.DIR: 'dir'>,
# path='/tmp/test-dir',
# size=40,
# mode=493,
# permissions='drwxr-xr-x',
# owner='user',
# group='user',
# modified_time=datetime.datetime(2026, 6, 3, 12, 16, 4, 858056),
# symlink_target=None
# )
sandbox.kill()