ptools

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertString

func ConvertString(s string) string

转换编码解决chcp936的中文乱码问题

func DownloadFile

func DownloadFile(url string, location string) error

下载文件 (下载地址,存放位置)

func Exec

func Exec(command string) (output string, err error)

执行一次command指令 跨平台兼容

func ExecRealtime

func ExecRealtime(command string, method func(line string)) error

执行一次command指令且自定义方法处理每行结果

func ExecRealtimeControl added in v0.0.3

func ExecRealtimeControl(command string, method func(line string), signal chan rune, winPssuspend string) error

winPssuspend留空

func ExecRealtimePrint

func ExecRealtimePrint(command string) error

执行一次command指令且实时输出每行结果

func ExecRealtimePrintGBK

func ExecRealtimePrintGBK(command string) error

执行时解决cmd chcp 936 乱码问题 P.S. !win好像不用

func FormatAbsPath

func FormatAbsPath(s string) string

规格化到绝对路径

func FormatPath

func FormatPath(s string) string

规格化路径

func GetBinaryPath

func GetBinaryPath(binary string) (string, error)

查找(环境变量+当前位置)可执行文件的位置

func GetHttpData

func GetHttpData(url string) (string, error)

利用HTTP Get请求获得数据

func Getwd

func Getwd() (wd string)

获取当前程序路径 最好直接用 os.Getwd

func IsFileExisted

func IsFileExisted(path string) bool

判断文件/文件夹是否存在

func IsNonASCII

func IsNonASCII(str string) bool

判断是不是non-ASCII

func Pause added in v0.0.3

func Pause(a chan rune)

实时控制的时候暂停

func Quit added in v0.0.3

func Quit(a chan rune)

实时控制的时候结束

func ReadAll

func ReadAll(path string) (string, error)

快速打开文件和读内容

func Resume added in v0.0.3

func Resume(a chan rune)

实时控制的时候继续

func ScanCRandLF added in v0.0.3

func ScanCRandLF(data []byte, atEOF bool) (advance int, token []byte, err error)

自定义Scanner分割的方式,\n和\r都分割

func Test

func Test()

简单测试 打个招呼

func WriteFast

func WriteFast(filePath string, content string) error

快速文件写先清空再写入

func XCopy

func XCopy(from, to string) error

复制文件夹或者文件

func XMove

func XMove(from, to string) error

移动文件夹或者文件

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL