From 13b1ad0e5d7f42ce26a2c7fa116e2dcfefcf45c6 Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Wed, 14 Dec 2022 04:33:57 -0800 Subject: [PATCH] initial commits --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 719dbec..9783dca 100644 --- a/README.md +++ b/README.md @@ -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 = ""+"\n"+"Hello world!" + +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 = ®ularfile + +```