{"id":15485945,"url":"https://github.com/licoy/stail","last_synced_at":"2025-04-22T16:42:55.434Z","repository":{"id":57640668,"uuid":"434083826","full_name":"Licoy/stail","owner":"Licoy","description":":rocket: 通过系统级的命令(如`tail -f`)来循环显示文件尾部数据 | Use system-level commands (such as `tail -f`) to display tail data in a loop","archived":false,"fork":false,"pushed_at":"2021-12-03T05:23:32.000Z","size":8,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-17T07:16:57.714Z","etag":null,"topics":["fsnotify","monitor","powershell","tail"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Licoy.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}},"created_at":"2021-12-02T04:41:30.000Z","updated_at":"2024-02-06T05:47:02.000Z","dependencies_parsed_at":"2022-09-05T05:31:52.956Z","dependency_job_id":null,"html_url":"https://github.com/Licoy/stail","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Licoy%2Fstail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Licoy%2Fstail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Licoy%2Fstail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Licoy%2Fstail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Licoy","download_url":"https://codeload.github.com/Licoy/stail/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250279192,"owners_count":21404341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["fsnotify","monitor","powershell","tail"],"created_at":"2024-10-02T06:05:04.540Z","updated_at":"2025-04-22T16:42:55.408Z","avatar_url":"https://github.com/Licoy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"中文 | [English](./README_EN.md)\n\n## :rocket: 介绍\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eStail\u003c/h1\u003e\n  \u003cp\u003e通过系统级的命令( 如 `tail -f` )来实时监控文件变动\u003c/p\u003e\n\u003c/div\u003e\n\n## :wrench: 安装\n```\ngo get github.com/Licoy/stail\n```\n## :hammer: 使用\n```golang\nfunc useSTail(filepath string, tailLine int) {\n    st, err := stail.New(stail.Options{})\n    if err != nil {\n        fmt.Println(err)\n        return\n    }\n    si, err := st.Tail(filepath, tailLine, func(content string) {\n        fmt.Print(fmt.Sprintf(\"获取到内容: %s\", content))\n    })\n    if err != nil {\n        fmt.Println(err)\n        return\n    }\n    time.AfterFunc(time.Second*10, func() {\n        err = si.Close() // 10s之后关闭获取通道\n    }\n    si.Watch()\n}\n```\n相当于\n```bash\ntail -{tailLine}f {filepath}\n```\n## :bulb: 参数\n- `filepath` 需要监听的文件路径\n- `tailLine` 只查看末尾的指定行\n- `call` 内容回调func，内容类型为string \n\n## :memo: 协议\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flicoy%2Fstail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flicoy%2Fstail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flicoy%2Fstail/lists"}