Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soypat/rebed
Recreates directory and files from embedded filesystem using Go 1.16 embed.FS type.
https://github.com/soypat/rebed
embedded embedded-files filesystem golang resource-embedding static-resources
Last synced: 7 days ago
JSON representation
Recreates directory and files from embedded filesystem using Go 1.16 embed.FS type.
- Host: GitHub
- URL: https://github.com/soypat/rebed
- Owner: soypat
- License: bsd-3-clause
- Created: 2021-02-17T18:19:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-18T13:20:07.000Z (over 2 years ago)
- Last Synced: 2024-10-12T09:11:27.001Z (23 days ago)
- Topics: embedded, embedded-files, filesystem, golang, resource-embedding, static-resources
- Language: Go
- Homepage:
- Size: 33.2 KB
- Stars: 29
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - rebed - Recreate folder structures and files from Go 1.16's `embed.FS` type (Resource Embedding / HTTP Clients)
- zero-alloc-awesome-go - rebed - Recreate folder structures and files from Go 1.16's `embed.FS` type (Resource Embedding / HTTP Clients)
- awesome-ccamel - soypat/rebed - Recreates directory and files from embedded filesystem using Go 1.16 embed.FS type. (Go)
- awesome-go-extra - rebed - 02-17T18:19:49Z|2022-02-18T13:20:07Z| (Resource Embedding / HTTP Clients)
README
# rebed
[![codecov](https://codecov.io/gh/soypat/rebed/branch/main/graph/badge.svg)](https://codecov.io/gh/soypat/rebed)
[![Build Status](https://travis-ci.org/soypat/rebed.svg?branch=main)](https://travis-ci.org/soypat/rebed)
[![Go Report Card](https://goreportcard.com/badge/github.com/soypat/rebed)](https://goreportcard.com/report/github.com/soypat/rebed)
[![go.dev reference](https://pkg.go.dev/badge/github.com/soypat/rebed)](https://pkg.go.dev/github.com/soypat/rebed)
[![Awesome](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go/blob/master/README.md#resource-embedding)
[![Sourcegraph](https://sourcegraph.com/github.com/soypat/rebed/-/badge.svg)](https://sourcegraph.com/github.com/soypat/rebed?badge)Recreate embedded filesystems from embed.FS type in current working directory.
Expose the files you've embedded in your binary so users can see and/or tinker with them. See [where is this useful](#where-is-this-useful) for an application example.
Install with (requires Go 1.16+)
```shell-script
go get -u github.com/soypat/rebed
```## Five actions available:
```go
//go:embed someFS/*
var bdFS embed.FS// Just replicate folder Structure
rebed.Tree(bdFS, "")// Make empty files
rebed.Touch(bdFS, "")// Recreate entire FS
rebed.Write(bdFS, "")// Recreate FS without modifying existing files
rebed.Patch(bdFS, "")// Runs Patch if no conflicting file is found, else error.
err := rebed.Create(bdFS, "")/* Walk allows you operate on each file as you wish */
```### Where is this useful?
You could theoretically embed your web development assets folder and deploy it. The binary could run from the working directory folder generated by `rebed` and users could modify the assets and change the website's look (to do this run `rebed.Patch` to not overwrite modified files). If asset files are lost or the site breaks, running `rebed.Write` replaces all files with original ones.## Contributing
I'll look at issues and pull requests. Add a clear explanation when doing so!