Files
projectdiscovery-httpx/common/fileutil/fileutil.go
T
2020-05-29 09:37:55 +00:00

25 lines
440 B
Go

package fileutil
import "os"
// FileExists checks if a file exists and is not a directory
func FileExists(filename string) bool {
info, err := os.Stat(filename)
if os.IsNotExist(err) {
return false
}
return !info.IsDir()
}
// HasStdin determines if the user has piped input
func HasStdin() bool {
fi, err := os.Stdin.Stat()
if err != nil {
return false
}
if fi.Mode()&os.ModeNamedPipe == 0 {
return false
}
return true
}