{"id":37073238,"url":"https://github.com/alexwoo1900/ymodem","last_synced_at":"2026-01-14T08:35:49.208Z","repository":{"id":49386195,"uuid":"127256137","full_name":"alexwoo1900/ymodem","owner":"alexwoo1900","description":"YMODEM written by Python - 用Python实现的YMODEM通讯协议","archived":false,"fork":false,"pushed_at":"2024-07-19T01:09:54.000Z","size":43084,"stargazers_count":98,"open_issues_count":7,"forks_count":55,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-11-29T04:18:56.789Z","etag":null,"topics":["python","ymodem"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexwoo1900.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-29T07:46:23.000Z","updated_at":"2025-11-23T19:17:53.000Z","dependencies_parsed_at":"2024-04-08T06:47:31.744Z","dependency_job_id":null,"html_url":"https://github.com/alexwoo1900/ymodem","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alexwoo1900/ymodem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwoo1900%2Fymodem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwoo1900%2Fymodem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwoo1900%2Fymodem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwoo1900%2Fymodem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexwoo1900","download_url":"https://codeload.github.com/alexwoo1900/ymodem/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwoo1900%2Fymodem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:31:27.429Z","status":"ssl_error","status_checked_at":"2026-01-14T08:31:19.098Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","ymodem"],"created_at":"2026-01-14T08:35:48.603Z","updated_at":"2026-01-14T08:35:49.200Z","avatar_url":"https://github.com/alexwoo1900.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![ymodem-logo](https://raw.githubusercontent.com/alexwoo1900/ymodem/master/docs/assets/ymodem-logo.png)\n\nThe YMODEM project is based on XMODEM implementation written by tehmaze. It is also compatible with XMODEM mode.\n\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT)\n\n\nREADME: [ENGLISH](https://github.com/alexwoo1900/ymodem/blob/master/README.md) | [简体中文](https://github.com/alexwoo1900/ymodem/blob/master/README_CN.md)\n\n- [**Installation**](#installation)\n- [**Usage**](#usage)\n  - [CLI TOOL](#cli-tool) \n    - [Sending a batch of files](#sending-a-batch-of-files)\n    - [Receive a file](#receive-a-file)\n  - [Source Code](#source-code)\n  - [API](#api)\n    - [Create MODEM Object](#create-modem-object)\n    - [Send files](#send-files)\n    - [Receive files](#receive-files)\n- [Debug](#debug)\n- [Changelog](#changelog)\n- [License](#license)\n\n## Demo\n\n### Test the sending and receiving functions\n\n![SenderAndReceiver](https://raw.githubusercontent.com/alexwoo1900/ymodem/master/docs/assets/console_test.gif)\n\n### Interact with SecureCRT\n\nInteract with SecureCRT as sender\n![SecureCRT1](https://raw.githubusercontent.com/alexwoo1900/ymodem/master/docs/assets/sender.gif)\n\nInteract with SecureCRT as Finder\n![SecureCRT2](https://raw.githubusercontent.com/alexwoo1900/ymodem/master/docs/assets/receiver.gif)\n\n## Installation\n```Bash\npip install ymodem\n```\n\n## Usage\n\n### CLI TOOL\n\n```Bash\n# To get help\nymodem -h\n# or\npython -m ymodem -h\n```\n\n#### Sending a batch of files\n```Bash\nymodem send ./file.bin ./file2.bin -p COM4 -b 115200\n# or\npython -m ymodem send ./file.bin ./file2.bin -p COM4 -b 115200\n```\n\n#### Receive a file\n```Bash\nymodem recv ./ -p COM4 -b 115200\n# or\npython -m ymodem recv ./ -p COM4 -b 115200\n```\n\n### Source Code\n\n```python\nfrom ymodem.Socket import ModemSocket\n\n# define read\ndef read(size, timeout = 3):\n    # implementation\n\n# define write\ndef write(data, timeout = 3):\n    # implementation\n\n# create socket\ncli = ModemSocket(read, write)\n\n# send multi files\ncli.send([file_path1, file_path2, file_path3 ...])\n\n# receive multi files\ncli.recv(folder_path)\n```\n\nFor more detailed usage, please refer to __main__.py.\n\n\n### API\n\n#### Create MODEM Object\n\n```python\ndef __init__(self, \n             read: Callable[[int, Optional[float]], Any], \n             write: Callable[[Union[bytes, bytearray], Optional[float]], Any], \n             protocol_type: int = ProtocolType.YMODEM, \n             protocol_type_options: List[str] = [],\n             packet_size: int = 1024,\n             style_id: int = _psm.get_available_styles()[0]):\n```\n- protocol_type: Protocol type, see Protocol.py\n- protocol_type_options: such as g representing the YMODEM-G in the YMODEM protocol.\n- packet_size: The size of a single packet, 128/1024 bytes, may be adjusted depending on the protocol style\n- style_id: Protocol style, different styles have different support for functional features\n\n#### Send files\n\n```python\ndef send(self, \n         paths: List[str], \n         callback: Optional[Callable[[int, str, int, int], None]] = None\n        ) -\u003e bool:\n```\n\n- callback: callback function. see below.\n\n    Parameter | Description\n    -|-\n    task index | index of current task\n    task (file) name | name of the file\n    total packets | number of packets plan to send\n    success packets | number of packets successfully sent\n\n#### Receive files\n\n```python\ndef recv(self, \n         path: str, \n         callback: Optional[Callable[[int, str, int, int], None]] = None\n        ) -\u003e bool:\n```\n- path: folder path for storing the target file\n- callback: callback function. Same as the callback of send().\n\n#### ATTENTION\n\nDepending on different communication environments, developers may need to manually adjust timeout parameters in _read_and_wait or _write_and_wait.\n\n## Debug\n\nIf you want to output debugging information, set the log level to DEBUG.\n\n```python\nlogging.basicConfig(level=logging.DEBUG, format='%(message)s')\n```\n\n## Changelog\n\n### v1.5 (2024/02/03)\n\n- Added cli tool to iteract with YMODEM via Serial bus\n\n\n### v1.5 (2023/05/20 11:00 +00:00)\n\n- Rewritten send() and recv()\n- Support YMODEM-G. \n    The success rate of YMODEM-G based on pyserial depends on the user's OS, and after testing, the success rate is very low without any delay.\n\n## License\n[MIT License](https://opensource.org/licenses/MIT)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexwoo1900%2Fymodem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexwoo1900%2Fymodem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexwoo1900%2Fymodem/lists"}