Gomaton
指南
API
GitHub
指南
API
GitHub
  • 前言

    • 快速开始
    • 能力速查
    • 工作原理
    • 硬件输入后端(ESP32 HID)
  • API 参考

    • motion - 触控 / 输入
    • images - 找图找色 / 截图
    • uiacc - 控件(UI 树)
    • device - 设备
    • app - 应用
    • ime - 输入法
    • ocr - 文字识别
    • yolo - 目标检测
    • files - 文件
    • storages - 键值存储
    • https - 网络
    • media - 媒体
    • system - 系统
    • utils - 工具

https — 网络

import "gomaton.dev/sdk/https"

Package https 网络请求(纯 Go 标准库)。timeoutSec<=0 取默认 30 秒。

能力总览:Get / Post 基本请求、PostMultipart 表单上传文件、Download 下载到设备文件。 均返回状态码,便于判成败。

Download

func Download(url, path string, timeoutSec int) (int, int64, error)

Download 下载到设备路径,返回 (状态码, 字节数, 错误)。

Get

func Get(url string, timeoutSec int) (int, []byte, error)

Get 发 GET,返回 (状态码, 响应体, 错误)。

Post

func Post(url string, data []byte, headers map[string]string, timeoutSec int) (int, []byte, error)

Post 发 POST(自定义 body 与头),headers 可空。

PostMultipart

func PostMultipart(url, fileName string, fileData []byte, timeoutSec int) (int, []byte, error)

PostMultipart 以 multipart/form-data 上传一个文件(字段名 file)。

上次更新: 2026/9/2 06:21
贡献者: hb
Prev
storages - 键值存储
Next
media - 媒体