Skip to content

Adds files.getInfo / files.get_info methods to retrieve information about directory/files #724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Jul 29, 2025

Conversation

mishushakov
Copy link
Member

@mishushakov mishushakov commented May 13, 2025

Changelog

  • Adds files.getInfo, files.get_info methods to the SDKs.
  • Adds tests for the new methods
  • Adds documentation for the above.

Examples

JavaScript

import { Sandbox } from '@e2b/code-interpreter'

const sandbox = await Sandbox.create()

// Create a new file
await sandbox.files.write('test_file.txt', 'Hello, world!')

// Get information about the file
const info = await sandbox.files.getInfo('test_file.txt')

console.log(info)
// {
//   name: 'test_file.txt',
//   type: 'file',
//   path: '/home/user/test_file.txt'
// }

Python

from e2b_code_interpreter import Sandbox

sandbox = Sandbox()

# Create a new file
sandbox.files.write('test_file', 'Hello, world!')

# Get information about the file
info = sandbox.files.get_info('test_file')

print(info)
# EntryInfo(name='test_file.txt', type=<FileType.FILE: 'file'>, path='/home/user/test_file.txt')

@mishushakov mishushakov self-assigned this May 13, 2025
@mishushakov mishushakov added the sdk Improvements or additions to SDKs label May 13, 2025
Copy link

linear bot commented May 13, 2025

Copy link

changeset-bot bot commented May 13, 2025

🦋 Changeset detected

Latest commit: 77f149a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@e2b/python-sdk Minor
e2b Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@jakubno jakubno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add more info about the file/directory?

@mishushakov
Copy link
Member Author

I'll be pushing more tests, waiting for e2b-dev/infra#655

Copy link
Member

Wasn't there a script using container for generating this? Or that was only for SDKs?

@mishushakov
Copy link
Member Author

Was it ever merged though? 🤔

@jakubno jakubno merged commit edeafb1 into main Jul 29, 2025
7 checks passed
@jakubno jakubno deleted the implement-filesget_info-method-e2b-2212 branch July 29, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request sdk Improvements or additions to SDKs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants