hunter/pre_file_com.go

29 lines
397 B
Go
Raw Normal View History

2020-05-18 10:24:01 +00:00
package hunter
import (
"io/ioutil"
"os"
"github.com/474420502/requests"
)
// PreFile Task的 file 预处理组件
type PreFile string
func (u PreFile) Hunt() (requests.IResponse, error) {
f, err := os.Open(string(u))
if err != nil {
panic(err)
}
data, err := ioutil.ReadAll(f)
if err != nil {
return nil, err
}
resp := &HResponse{}
resp.Hcontent = data
return resp, err
}