Documentation
¶
Index ¶
- Constants
- Variables
- func AddMimeTypeToFileInfo(path string, fileInfo *wshrpc.FileInfo)
- func ApplyEdits(originalContent []byte, edits []EditSpec) ([]byte, error)
- func DetectMimeType(path string, fileInfo fs.FileInfo, extended bool) string
- func DetectMimeTypeWithDirEnt(path string, dirEnt fs.DirEntry) string
- func FixPath(path string) (string, error)
- func IsInitScriptPath(input string) bool
- func ReplaceInFile(filePath string, edits []EditSpec) error
- func WinSymlinkDir(path string, bits os.FileMode) bool
- type DirEntryOut
- type EditSpec
- type FsFileInfo
- type ReadDirResult
Constants ¶
View Source
const (
MaxEditFileSize = 5 * 1024 * 1024 // 5MB
)
Variables ¶
View Source
var StaticMimeTypeMap = map[string]string{}/* 1260 elements not displayed */
Functions ¶
func AddMimeTypeToFileInfo ¶ added in v0.11.1
func ApplyEdits ¶ added in v0.12.2
ApplyEdits applies a series of edits to the given content and returns the modified content. Each edit's OldStr must appear exactly once in the content or an error is returned.
func DetectMimeType ¶
on error just returns "" does not return "application/octet-stream" as this is considered a detection failure can pass an existing fileInfo to avoid re-statting the file falls back to text/plain for 0 byte files
func DetectMimeTypeWithDirEnt ¶ added in v0.11.1
func IsInitScriptPath ¶
IsInitScriptPath tries to determine if the input string is a path to a script rather than an inline script content.
func ReplaceInFile ¶ added in v0.12.2
Types ¶
type DirEntryOut ¶ added in v0.12.2
type FsFileInfo ¶ added in v0.11.1
type FsFileInfo struct {
NameInternal string
ModeInternal os.FileMode
SizeInternal int64
ModTimeInternal int64
IsDirInternal bool
}
func ToFsFileInfo ¶ added in v0.11.1
func ToFsFileInfo(fi *wshrpc.FileInfo) FsFileInfo
ToFsFileInfo converts wshrpc.FileInfo to FsFileInfo. It panics if fi is nil.
func (FsFileInfo) IsDir ¶ added in v0.11.1
func (f FsFileInfo) IsDir() bool
func (FsFileInfo) ModTime ¶ added in v0.11.1
func (f FsFileInfo) ModTime() time.Time
func (FsFileInfo) Mode ¶ added in v0.11.1
func (f FsFileInfo) Mode() os.FileMode
func (FsFileInfo) Name ¶ added in v0.11.1
func (f FsFileInfo) Name() string
func (FsFileInfo) Size ¶ added in v0.11.1
func (f FsFileInfo) Size() int64
func (FsFileInfo) Sys ¶ added in v0.11.1
func (f FsFileInfo) Sys() interface{}
type ReadDirResult ¶ added in v0.12.2
type ReadDirResult struct {
Path string `json:"path"`
AbsolutePath string `json:"absolute_path"`
ParentDir string `json:"parent_dir,omitempty"`
Entries []DirEntryOut `json:"entries"`
EntryCount int `json:"entry_count"`
TotalEntries int `json:"total_entries"`
Truncated bool `json:"truncated,omitempty"`
}
func ReadDirRecursive ¶ added in v0.12.2
func ReadDirRecursive(path string, maxEntries int) (*ReadDirResult, error)
Click to show internal directories.
Click to hide internal directories.