Skip to content
/ zipmeta Public

Scala client for fetching zip file metadata from remote source without downloading the entire file

Notifications You must be signed in to change notification settings

s-nel/zipmeta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZipMetadataService

Snacktrace Score

Enables you to fetch metadata from a remote zip file without downloading the entire file. This is useful if you don't know if the zip archive has the file you're looking for, and you don't want to download the entire file.

SBT Coordinates

libraryDependencies += "com.snacktrace" % "zipmeta_2.11" % "1.1.0"

Example

// Construct the service
val client = new ZipFileClientApache(new DefaultHttpClient())
val service = new ZipMetadataServiceImpl(client)

// List names of all files in remote zip file
service.getMetadata("http://www.colorado.edu/conflict/peace/download/peace.zip").map {
    metadata =>
        metadata.directoryRecords.map(record => println(record.fileName))
}

// Get a file that matches the given pattern
service.getFile("http://www.colorado.edu/conflict/peace/download/peace.zip", "^ab_cit.*$").map {
    file =>
        println(file.content)
}

About

Scala client for fetching zip file metadata from remote source without downloading the entire file

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages