Skip to content

feat(upload): Add text file upload#17

Open
lucasssvaz wants to merge 1 commit into
wokwi:mainfrom
lucasssvaz:feat/text_upload
Open

feat(upload): Add text file upload#17
lucasssvaz wants to merge 1 commit into
wokwi:mainfrom
lucasssvaz:feat/text_upload

Conversation

@lucasssvaz

Copy link
Copy Markdown

This pull request adds support for uploading text files (such as JSON, TOML, or YAML) to the simulator using a new upload_text method. It updates both the async and sync client interfaces, and enhances the file upload logic to automatically choose the correct upload method based on file extension. This improves usability and ensures text files are handled with the proper encoding.

New text file upload support:

  • Added a new upload_text async method to WokwiClient for uploading text-based files from a string, and updated the sync interface in WokwiClientSync accordingly. [1] [2]
  • Introduced the TextUploadParams model for text uploads.
  • Implemented a new upload_text function in file_ops.py to send text files to the server using the appropriate parameters.

Automatic file type detection:

  • Enhanced upload_file to detect text file extensions (.json, .toml, .txt, .yaml, .yml) and use the new text upload logic when appropriate; otherwise, it defaults to binary upload. [1] [2]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant