| Copyright | (c) 2015-2018 Futurice 2018 Oleg Grenrus |
|---|---|
| License | BSD-3-Clause |
| Maintainer | Oleg Grenrus <oleg.grenrus@iki.fi> |
| Safe Haskell | None |
| Language | Haskell2010 |
FileEmbedLzma
Description
- embedByteString :: FilePath -> Q Exp
- embedLazyByteString :: FilePath -> Q Exp
- embedText :: FilePath -> Q Exp
- embedLazyText :: FilePath -> Q Exp
- embedDir :: FilePath -> Q Exp
- embedRecursiveDir :: FilePath -> Q Exp
- listDirectoryFiles :: FilePath -> IO [(FilePath, ByteString)]
- listRecursiveDirectoryFiles :: FilePath -> IO [(FilePath, ByteString)]
- listDirectoryFilesF :: (FilePath -> IO [(FilePath, ByteString)]) -> FilePath -> IO [(FilePath, ByteString)]
- lazyBytestringE :: ByteString -> Q Exp
Embed files
embedByteString :: FilePath -> Q Exp Source #
Embed a strict ByteString from a file.
embedLazyByteString :: FilePath -> Q Exp Source #
Embed a lazy ByteString from a file.
Embed directories
embedDir :: FilePath -> Q Exp Source #
Embed a [( list, traversing given directory.FilePath, ByteString)]
embedRecursiveDir :: FilePath -> Q Exp Source #
Embed a [( list, recursively traversing given directory path.FilePath, ByteString)]
For example, with wai-static-app this can be used as:
staticApp $ embeddedSettings $(embedRecursiveDir "static")
-- is an embedded (no data-files!) equivalent of
staticApp $ defaultFileServerSettings "static"
Internal
Directory listing
listDirectoryFiles :: FilePath -> IO [(FilePath, ByteString)] Source #
listRecursiveDirectoryFiles :: FilePath -> IO [(FilePath, ByteString)] Source #
Arguments
| :: (FilePath -> IO [(FilePath, ByteString)]) | what to do with a sub-directory |
| -> FilePath | |
| -> IO [(FilePath, ByteString)] |
Template Haskell
lazyBytestringE :: ByteString -> Q Exp Source #
Makes lazy ByteString expression.
Embedded value is compressed with LZMA.