
Security News
Open VSX Begins Implementing Pre-Publish Security Checks After Repeated Supply Chain Incidents
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.
-- import "vimagination.zapto.org/httpdir"
Package httpdir provides an in-memory implementation of http.FileSystem
const (
ModeDir fs.FileMode = fs.ModeDir | 0o755
ModeFile fs.FileMode = 0o644
)
Convenient FileMode constants
var Default = New(time.Now())
Default is the Dir used by the top-level functions
func Create(name string, n Node) error
Create is a convenience function for Default.Create
func Mkdir(name string, modTime time.Time, index bool) error
Mkdir is a convenience function for Default.Mkdir
func Remove(name string) error
Remove is a convenience function for Default.Remove
type Dir struct {
}
Dir is the start of a simple in-memory filesystem tree
func New(t time.Time) Dir
New creates a new, initialised, Dir
func (d Dir) Create(name string, n Node) error
Create places a Node into the directory tree.
Any non-existent directories will be created automatically, setting the modTime to that of the Node and the index to false.
If you want to specify alternate modTime/index values for the directories, then you should create them first with Mkdir
func (d Dir) Mkdir(name string, modTime time.Time, index bool) error
Mkdir creates the named directory, and any parent directories required.
modTime is the modification time of the directory, used in caching mechanisms.
index specifies whether or not the directory allows a directory listing. NB: if the directory contains an index.html file, then that will be displayed instead, regardless the value of index.
All directories created will be given the specified modification time and index bool.
Directories already existing will not be modified.
func (d Dir) Open(name string) (http.File, error)
Open returns the file, or directory, specified by the given name.
This method is the implementation of http.FileSystem and isn't intended to be used by clients of this package.
func (d Dir) Remove(name string) error
Remove will remove a node from the tree.
It will remove files and any directories, whether they are empty or not.
Caution: httpdir does no internal locking, so you should provide your own if you intend to call this method.
type File interface {
io.Reader
io.Seeker
io.Closer
Readdir(int) ([]fs.FileInfo, error)
}
File represents an opened data Node
type Node interface {
Size() int64
Mode() fs.FileMode
ModTime() time.Time
Open() (File, error)
}
Node represents a data file in the tree
func FileBytes(data []byte, modTime time.Time) Node
FileBytes provides an implementation of Node that takes a byte slice as its data source
func FileString(data string, modTime time.Time) Node
FileString provides an implementation of Node that takes a string as its data source
type OSFile string
OSFile is the path of a file in the real filesystem to be put into the im-memory filesystem
func (o OSFile) ModTime() time.Time
ModTime returns the ModTime of the file
func (o OSFile) Mode() fs.FileMode
Mode returns the Mode of the file
func (o OSFile) Open() (File, error)
Open opens the file, returning it as a File
func (o OSFile) Size() int64
Size returns the size of the file
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.

Research
/Security News
Threat actors compromised four oorzc Open VSX extensions with more than 22,000 downloads, pushing malicious versions that install a staged loader, evade Russian-locale systems, pull C2 from Solana memos, and steal macOS credentials and wallets.

Security News
Lodash 4.17.23 marks a security reset, with maintainers rebuilding governance and infrastructure to support long-term, sustainable maintenance.