-
Notifications
You must be signed in to change notification settings - Fork 40
Not able to call different methods on the client for the same *os.File #29
Copy link
Copy link
Open
Description
Hi,
Thanks for the awesome package.
I am trying to run the following code but it only works for the first function call whether it be .Parse,.Detect or .Meta . I am wondering whether it is the limitation of the package or of golang GC itself and how could I solve it.
func ReadData(s *indexService) {
//Open the file
f, err := os.Open(fileDir)
if err != nil {
fmt.Println("[ERROR] Opening file")
}
defer f.Close()
c := context.Background()
//First function call works fine
docBody, err := s.TClient.Parse(c, f)
if err != nil {
fmt.Println("[ERROR] Reading body")
}
//Returns file already closed error
docContent, err := s.TClient.Detect(c, f)
if err != nil {
fmt.Println(err)
fmt.Println("[ERROR] Reading MIMETYPE")
}
//Returns file already closed error
docMeta, err := s.TClient.Meta(c, f)
if err != nil {
fmt.Println("[ERROR] Reading Meta-data")
}
defer func() {
fmt.Printf("Tika Processed: %s \n", fileName)
}()
}indexService looks like this -
type indexService struct {
TClient *tika.Client
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels