stuck on read/copy while extract rar file
glitterlip opened this issue · 1 comments
glitterlip commented
when extract file from some rar file, it just stuck without raise any error
here is the code
format := archiver.Rar{
ContinueOnError: true,
}
f, _ := os.Open("1-90215.rar")
err := format.Extract(context.Background(), f, nil, func(ctx context.Context, f archiver.File) error {
if strings.Index(f.Name(), ".ppt") > -1 {
ext := path.Ext(f.Name())
filename := fmt.Sprintf("%s%s","tmp", ext)
newfile, err := os.Create(filename)
if err != nil {
panic(err)
}
defer newfile.Close()
old, err := f.Open()
if err != nil {
panic(err)
}
defer old.Close()
_, err = io.Copy(newfile, old)
if err != nil {
panic(err)
}
fmt.Printf("extracted %s \n", f.Name())
}
return nil
})
try readall
stuck too, here is the file
1-90215.zip
glitterlip commented
never mind , it's a broken rar file