> ## Documentation Index
> Fetch the complete documentation index at: https://docs.novita.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# File & Directory

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

```js JavaScript & TypeScript icon="js" theme={"system"}
import { Novita } from 'novita-sandbox'

const novita = new Novita()
const sandbox = await novita.codeInterpreter.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()
```

```python Python icon="python" theme={"system"}
from novita_sandbox import Novita

novita = Novita()
sandbox = novita.code_interpreter.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

```js JavaScript & TypeScript icon="js" theme={"system"}
import { Novita } from 'novita-sandbox'

const novita = new Novita()
const sandbox = await novita.codeInterpreter.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()
```

```python Python icon="python" theme={"system"}
from novita_sandbox import Novita

novita = Novita()
sandbox = novita.code_interpreter.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()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.