initial commits

master
Charles Iliya Krempeaux 2022-12-14 04:33:57 -08:00
parent 0f88a2db7f
commit 13b1ad0e5d
1 changed files with 23 additions and 0 deletions

View File

@ -7,3 +7,26 @@ Package **strfs** provides a virtual file-system, whre a `fs.File` can be create
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-strfs
[![GoDoc](https://godoc.org/github.com/reiver/go-strfs?status.svg)](https://godoc.org/github.com/reiver/go-strfs)
## Example fs.File
Here is an example of turning a Go `string` into a `fs.File`:
```go
import "github.com/reiver/go-strfs"
// ...
var s string = "<!DOCTYPE html>"+"\n"+"<html><body>Hello world!</body></html>"
var content strfs.Content = strfs.CreateContent(s)
var regularfile strfs.RegularFile = strfs.RegularFile{
FileContent: content,
FileName: "helloworld.html",
FileModTIme: time.Date(2022, 12, 12, 10, 30, 14, 2, time.UTC),
}
var file fs.FS = &regularfile
```