file-embed-lzma-0: Use Template Haskell to embed (LZMA compressed) data.

Copyright(c) 2015-2018 Futurice 2018 Oleg Grenrus
LicenseBSD-3-Clause
MaintainerOleg Grenrus <oleg.grenrus@iki.fi>
Safe HaskellNone
LanguageHaskell2010

FileEmbedLzma

Contents

Description

 

Synopsis

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.

embedText :: FilePath -> Q Exp Source #

Embed a strict Text from a UTF8-encoded file.

embedLazyText :: FilePath -> Q Exp Source #

Embed a lazy Text from a UTF8-encoded file.

Embed directories

embedDir :: FilePath -> Q Exp Source #

Embed a [(FilePath, ByteString)] list, traversing given directory.

embedRecursiveDir :: FilePath -> Q Exp Source #

Embed a [(FilePath, ByteString)] list, recursively traversing given directory path.

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

listDirectoryFilesF 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.