Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Latest commit

 

History

History
47 lines (38 loc) · 912 Bytes

README.md

File metadata and controls

47 lines (38 loc) · 912 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 go.nandlabs.io/commons/vfs

Usage

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

package main

import (
    "fmt"
    "go.nandlabs.io/commons/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)
    }
}