| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Butler.Core.File
Description
This module contains the file system logic.
Synopsis
- data Entry
- data File
- data Directory
- readRootDirectory :: MonadIO m => RawFilePath -> m (Maybe Directory)
- newDirectory :: Directory -> FileName -> STM (Maybe Directory)
- getRootDir :: Directory -> Directory
- data FileName
- lookupChild :: Directory -> FileName -> STM (Maybe Entry)
- baseName :: RawFilePath -> RawFilePath
- deleteDirectory :: MonadIO m => Directory -> Directory -> m ()
- createFile :: MonadIO m => Directory -> FileName -> ByteString -> m File
- readFileBS :: MonadIO m => Directory -> File -> m ByteString
- writeFileBS :: MonadIO m => Directory -> File -> ByteString -> m ()
- deleteFile :: MonadIO m => Directory -> File -> m ()
- renameEntry :: MonadIO m => Directory -> Entry -> FileName -> m ()
- moveEntry :: MonadIO m => Directory -> Directory -> Entry -> m ()
- data FileLoc
- getFileLoc :: Directory -> Maybe File -> FileLoc
- resolveFileLoc :: Directory -> FileLoc -> STM (Maybe (Directory, Maybe File))
- data PartialFile
- createPartialFile :: MonadIO m => Directory -> FileName -> m PartialFile
- appendPartialFile :: MonadIO m => PartialFile -> ByteString -> m ()
- finalizePartialFile :: MonadIO m => PartialFile -> FileOffset -> m File
- data ContentType
- fileContentType :: File -> ContentType
File system data types
Entry is the base element of a file system.
Instances
| ToJSON File # | |
Defined in Butler.Core.File | |
Instances
| ToJSON Directory # | |
Defined in Butler.Core.File | |
readRootDirectory :: MonadIO m => RawFilePath -> m (Maybe Directory) #
Read the root directory content, return Nothing when the file path is not a directory. You must call this function to get the first directory.
Directory API
getRootDir :: Directory -> Directory #
Return the outer most directory.
FileName are provided by the user, they must not begin or end with a /.
Instances
| FromJSON FileName # | |
| ToJSON FileName # | |
Defined in Butler.Core.File | |
| IsString FileName # | |
Defined in Butler.Core.File Methods fromString :: String -> FileName # | |
| Monoid FileName # | |
| Semigroup FileName # | |
| Show FileName # | |
| Eq FileName # | |
| Ord FileName # | |
Defined in Butler.Core.File | |
| ToHtml FileName # | |
| From Entry FileName # | |
Defined in Butler.Core.File | |
| From FileName FileLoc # | |
Defined in Butler.Core.File | |
| From FileName Text # | |
Defined in Butler.Core.File | |
| From FileName RawFilePath # | |
Defined in Butler.Core.File Methods from :: FileName -> RawFilePath # | |
| From RawFilePath FileName # | |
Defined in Butler.Core.File Methods from :: RawFilePath -> FileName # | |
baseName :: RawFilePath -> RawFilePath #
deleteDirectory :: MonadIO m => Directory -> Directory -> m () #
File API
createFile :: MonadIO m => Directory -> FileName -> ByteString -> m File #
readFileBS :: MonadIO m => Directory -> File -> m ByteString #
writeFileBS :: MonadIO m => Directory -> File -> ByteString -> m () #
deleteFile :: MonadIO m => Directory -> File -> m () #
Rename/Move API
External API
The absolute location of a directory, for remote user.
Upload API
data PartialFile #
createPartialFile :: MonadIO m => Directory -> FileName -> m PartialFile #
appendPartialFile :: MonadIO m => PartialFile -> ByteString -> m () #
finalizePartialFile :: MonadIO m => PartialFile -> FileOffset -> m File #
Mime API
data ContentType #
Constructors
| BinaryContent | |
| ImageContent | |
| VideoContent | |
| TextContent | |
| ArchiveContent |
Instances
fileContentType :: File -> ContentType #