vfile

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 4 Imported by: 0

README

go-vfile

A virtual file system for go in runtime.

Example

Easy

package main

import (
	"embed"
	"fmt"
	"os"
	"os/signal"
	"syscall"

	"github.com/Teages/go-vfile"
)

//go:embed files/*
var f embed.FS

func run() {
	fmt.Println(vfile.GetPath("."))
	err := vfile.JoinAll(".", f)
	fmt.Println(err)
}

func main() {
	c := make(chan os.Signal)
	signal.Notify(c, syscall.SIGINT)
	go func() {
		<-c
		vfile.Close()
		os.Exit(0)
	}()
	run()
	vfile.Close()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func GetPath

func GetPath(fileDir string) string

func Join

func Join(fileDir string, data []byte) error

func JoinAll

func JoinAll(fileDir string, f embed.FS) error

func JoinPart added in v0.0.2

func JoinPart(fileDir, partDir string, f embed.FS) error

func Remove

func Remove(fileDir string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL