github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/common/cmdarg/arg.go (about) 1 package cmdarg 2 3 import ( 4 "bytes" 5 "io" 6 "os" 7 ) 8 9 // LoadArg loads one arg, maybe an remote url, or local file path 10 func LoadArg(arg string) (out io.Reader, err error) { 11 bs, err := LoadArgToBytes(arg) 12 if err != nil { 13 return nil, err 14 } 15 out = bytes.NewBuffer(bs) 16 return 17 } 18 19 // LoadArgToBytes loads one arg to []byte, maybe an remote url, or local file path 20 func LoadArgToBytes(arg string) (out []byte, err error) { 21 out, err = os.ReadFile(arg) 22 if err != nil { 23 return 24 } 25 return 26 }