strfs provides a virtual file-system, where a fs.File can be created from a Go string.
Go to file
Charles Iliya Krempeaux 13e37a7f9f github.com/reiver/go-strfs -> sourcecode.social/reiver/go-strfs 2023-10-23 11:50:51 -07:00
LICENSE initial commits 2022-12-13 19:36:32 -08:00
README.md corrected typo in docs. "TIme" -> "Time" 2023-10-23 11:48:20 -07:00
content.go corrected typo in docs. "TIme" -> "Time" 2023-10-23 11:48:20 -07:00
content_test.go github.com/reiver/go-strfs -> sourcecode.social/reiver/go-strfs 2023-10-23 11:50:51 -07:00
errors.go github.com/reiver/go-fck - sourcecode.social/reiver/go-erorr 2023-10-23 11:44:12 -07:00
fileinfo.go initial commits 2022-12-14 09:50:42 -08:00
go.mod github.com/reiver/go-strfs -> sourcecode.social/reiver/go-strfs 2023-10-23 11:46:25 -07:00
go.sum github.com/reiver/go-fck - sourcecode.social/reiver/go-erorr 2023-10-23 11:44:12 -07:00
regularfile.go corrected typo in docs. "TIme" -> "Time" 2023-10-23 11:48:20 -07:00
regularfile_test.go github.com/reiver/go-strfs -> sourcecode.social/reiver/go-strfs 2023-10-23 11:46:25 -07:00

README.md

go-strfs

Package strfs provides a virtual file-system, whre a fs.File can be created from a Go string.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-strfs

GoDoc

Example fs.File

Here is an example of turning a Go string into a fs.File:

import "sourcecode.social/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