Skip to content

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

Merged
jakubno merged 26 commits intomainfrom
implement-filesget_info-method-e2b-2212
Jul 29, 2025
Merged

Adds files.getInfo / files.get_info methods to retrieve information about directory/files#724
jakubno merged 26 commits intomainfrom
implement-filesget_info-method-e2b-2212

Conversation

@mishushakov
Copy link
Copy Markdown
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
@linear
Copy link
Copy Markdown

linear Bot commented May 13, 2025

@changeset-bot
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Member Author

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

Comment thread Makefile
Comment thread spec/envd/buf-python.gen.yaml
Copy link
Copy Markdown
Member

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

@mishushakov
Copy link
Copy Markdown
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