hnix-store-core-0.7.0.0: Core effects for interacting with the Nix store.
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Nix.Internal.Nar.Streamer

Description

Stream out a NAR file from a regular file

Synopsis

Documentation

type NarSource m = (ByteString -> m ()) -> m () Source #

NarSource The source to provide nar to the handler `(ByteString -> m ())`. It is isomorphic to ByteString by Yoneda lemma if the result is meant to be m (). It is done in CPS style so IO can be chunks.

dumpString Source #

Arguments

:: forall m. MonadIO m 
=> ByteString

the string you want to dump

-> NarSource m

The nar result in CPS style

dumpString dump a string to nar in CPS style. The function takes in a ByteString, and build a `NarSource m`.

dumpPath Source #

Arguments

:: forall m. MonadIO m 
=> FilePath

path for the file you want to dump to nar

-> NarSource m

the nar result in CPS style

dumpPath shorthand build a Source that turn file path to nar using the default narEffectsIO.

streamNarIO :: forall m. MonadIO m => NarEffects IO -> FilePath -> NarSource m Source #

This implementation of Nar encoding takes an arbitrary yield function from any streaming library, and repeatedly calls it while traversing the filesystem object to Nar encode