Skip to content

gohxs/folder2go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

folder2go

Simple app to Embed a directory into a go package, All files would be on a map[string][]byte where string is the filename

Usage:

go get github.com/gohxs/folder2go

folder2go /path generated

Using

import (
	"mypkg/generated"
	"fmt"
)

func main() {
	fmt.Printf("%s",string(generated.Data["file.txt"]	))
}

Result file:

// Package pkg -- Generated by folder2go
package pkg

//Data exported data taken from folder .
var Data = map[string][]byte{
	"README.md": []byte("\x66\x6F\x6C\x64\x65\x72\x32\x67\x6F\x0A\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x3D\x0A\x0A\x45..."}
	"main.go":   []byte("\x2F\x2F\x20\x47\x72\x61\x62\x73\x20\x61\x20\x66\x6F\x6C\x64\x65\x72\x20\x61\x6E\x64\x20\x67\x65..."}
}

Todo

[ ] Support for golang virtual FS [ ] Optional embed Compression [ ] Concurrent file processing AND/OR direct writing to .go file

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages