1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-23 02:26:49 -05:00
v2fly/common/cmdarg/arg.go
guangwu 39d2f293c6
chore: remove refs to deprecated io/ioutil (#2717)
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-10-16 10:23:50 +08:00

27 lines
486 B
Go

package cmdarg
import (
"bytes"
"io"
"os"
)
// LoadArg loads one arg, maybe an remote url, or local file path
func LoadArg(arg string) (out io.Reader, err error) {
bs, err := LoadArgToBytes(arg)
if err != nil {
return nil, err
}
out = bytes.NewBuffer(bs)
return
}
// LoadArgToBytes loads one arg to []byte, maybe an remote url, or local file path
func LoadArgToBytes(arg string) (out []byte, err error) {
out, err = os.ReadFile(arg)
if err != nil {
return
}
return
}