Skip to content

Instantly share code, notes, and snippets.

@ericxyan
ericxyan / http-stream-file.hs
Created March 14, 2016 18:34 — forked from singpolyma/http-stream-file.hs
Stream a file as it is created (such as a video)
module Main (main) where
import Control.Monad (forever, when)
import System.Environment (getArgs)
import System.IO (withBinaryFile, hIsEOF, IOMode(ReadMode), hSetBuffering, BufferMode(BlockBuffering))
import Control.Concurrent (threadDelay)
import Blaze.ByteString.Builder.ByteString (fromByteString)
import Data.ByteString (ByteString)
import Data.ByteString as BS
import Data.Text as T