joelanford / goscan

A simple tool to scan text, binary, and archive files for keywords
MIT License
2 stars 2 forks source link

Replace unar with golang libs for types supported by native libraries #1

Open joelanford opened 7 years ago

joelanford commented 7 years ago

unar works with many common compression and archive formats out of the box, but using it requires shelling out of the native go program, it uses space on a filesystem, and scanning is faster in memory.

Most likely, native golang libraries cannot be found for all of the types unar supports, but libraries for the most common types probably do exist. For example:

What does it take to use these native libaries instead of unar for these (and potentially other) types of files?

joelanford commented 7 years ago

With the addition of the MultiPatternSearchReader and MultiPatternSearchReader, this will most likely be easier to implement, assuming the aforementioned libraries provide io.ReadSeeker and/or io.Reader interfaces to the data.

One thing to think through will be how to handle archive/compressed files contained in archives whose formats are not supported by go libraries. They'll most likely need to be written to disk or streamed as STDIN so that unar can still take a shot.