// From the code to initialize AXIS in Rubble
fs := new(axis2.FileSystem)

fs.Mount("df", sources.NewOSDir(dfdir), true)
fs.Mount("rubble", sources.NewOSDir(rubbledir), true)
fs.Mount("out", sources.NewOSDir(output), true)
for i := range addonsdir {
fs.Mount("addons", sources.NewOSDir(addonsdir[i]), true)
}

// From part of the Rubble addon loader (mount and read from a zip file)
content, err := fs.ReadAll("addons/"+name+".zip")
if err != nil {
errors.RaiseWrappedError("While reading zip file:", err)
}

ds, err = zip.NewRawDir(content)
if err != nil {
errors.RaiseWrappedError("While reading zip file:", err)
}

fs.Mount("loader/pack", ds, false)
meta = loadPackMeta(fs, "loader/pack")
fs.Unmount("loader/pack", true)

// More code from the loader
for _, filepath := range fs.ListFiles(dirpath) {
content, err := fs.ReadAll(path+filepath)
if err != nil {
panic(err)
}

...
}

Have some random excerpts from Rubble (the main client for AXIS right now). 
Obviously there are just code snippets, but they should be helpful. I'll 
write some proper examples for the package sooner or later...

On Friday, October 21, 2016 at 4:20:15 PM UTC-4, milo.chr...@gmail.com 
wrote:
>
> AXIS VFS public repository <https://github.com/milochristiansen/axis2>
>
> Today I am proud to announce the public release of AXIS VFS, a simple and 
> lightweight virtual file system API. AXIS' intended purpose is to abstract 
> file IO so that the client program does not need to know anything about the 
> system it is running on and to allow files from dissimilar sources to be 
> read with a unified API.
>
> I personally use AXIS in a data file loader to support multiple source 
> directories and loading from zip files, but this API has many other uses.
>
> I hope you will find this simple little library useful!
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to