Skip to content

Latest commit

 

History

History
47 lines (38 loc) · 910 Bytes

README.md

File metadata and controls

47 lines (38 loc) · 910 Bytes

Virtual File System (VFS) Package

The VFS package provides a unified api for accessing multiple file system. It is extensible and new implementation can be easily plugged in.

The default package has methods for local file system.



Installation

go get oss.nandlabs.io/golly/vfs

Usage

A simple usage of the library to create a directory in the OS.

package main

import (
    "fmt"
    "oss.nandlabs.io/golly/vfs"
)

var (
    testManager = GetManager()
)

func GetRawPath(input string) (output string) {
    currentPath, _ := os.Getwd()
    u, _ := url.Parse(input)
    path := currentPath + u.Path
    output = u.Scheme + "://" + path
    return
}

func main() {
    u := GetRawPath("file:///test-data")
    _, err := testManager.MkdirRaw(u)
    if err != nil {
       fmt.Errorf("MkdirRaw() error = %v", err)
    }
}