Comments (3)
I've merged support for dealing with multiple volumes, just open the file of the first volume, i.e.:
r, err := sevenzip.OpenReader("archive.7z.001")
if err != nil {
log.Fatal(err)
}
defer r.Close()
from sevenzip.
Not directly, no.
However the library just wants something that implements the io.ReaderAt
interface and as the archive is just the concatenation of its parts, all you need is something similar to io.MultiReader()
to join the parts/volumes together but with the right interface. Thankfully such a thing already exists in readerutil.NewMultiReaderAt(). The following code works:
package main
import (
"errors"
"io"
"log"
"os"
"github.com/bodgit/sevenzip"
"go4.org/readerutil"
)
func main() {
sr := make([]readerutil.SizeReaderAt, 0, len(os.Args[1:]))
for _, part := range os.Args[1:] {
f, err := os.Open(part)
if err != nil {
log.Fatal(err)
}
defer f.Close()
size, ok := readerutil.Size(f)
if !ok {
log.Fatal(errors.New("unable to calculate size"))
}
sr = append(sr, io.NewSectionReader(f, 0, size))
}
mr := readerutil.NewMultiReaderAt(sr...)
r, err := sevenzip.NewReader(mr, mr.Size())
if err != nil {
log.Fatal(err)
}
// Do something with r
}
I'm undecided whether to add this functionality to the library but the above code will work regardless.
from sevenzip.
thanks a lot
from sevenzip.
Related Issues (20)
- runtime error: index out of range [0] with length 0 HOT 9
- "invalid memory address or nil pointer dereference" when opening 7z file HOT 1
- Errors are not accessible since they are private with a lower case
- Low performance of .7z files with password HOT 2
- Extract files from a self-extracting exe HOT 8
- panic: runtime error: index out of range HOT 2
- low performance for aes7z HOT 2
- warning: a function definition without a prototype is deprecated in all versions HOT 2
- 解带密码的提示 Failed to open file in archive: lzma: unsupported chunk header byte HOT 1
- How to extract HOT 1
- Return list of volume archive files. HOT 14
- seek over file in archive HOT 2
- Support BCJ method HOT 8
- Support PPC method
- Unable to decrypt 7-ZIP file with password (err: breader.ReadByte: no data!) HOT 1
- Unable to decrypt 7-ZIP file with password (err: breader.ReadByte: no data!) HOT 1
- sevenzip as a guide HOT 3
- Add support for reading self-extracting archives
- Empty File processing issue HOT 4
- Fail to read .exe in .7z HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sevenzip.