packages feed

snap-stream 0.1 → 0.1.1.0

raw patch · 5 files changed

+69/−26 lines, 5 filesdep ~basesetup-changednew-uploaderPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

- Snap.Util.FileServe.Stream: RangeReq :: !Word64 -> !(Maybe Word64) -> RangeReq
+ Snap.Util.FileServe.Stream: RangeReq :: !Word64 -> !Maybe Word64 -> RangeReq
- Snap.Util.FileServe.Stream: checkRangeReq :: (MonadSnap m) => Request -> (Word64 -> Word64 -> OutputStream Builder -> IO ()) -> Word64 -> m Bool
+ Snap.Util.FileServe.Stream: checkRangeReq :: MonadSnap m => Request -> (Word64 -> Word64 -> OutputStream Builder -> IO ()) -> Word64 -> m Bool

Files

− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
+ changelog.md view
@@ -0,0 +1,9 @@+# Changelog for snap-stream++## 0.1.1.0++* Loosen `base` version bounds++## 0.1++* Initial release: Snap handlers for streaming access with range requests
+ readme.md view
@@ -0,0 +1,5 @@+# snap-stream++[Snap](https://hackage.haskell.org/package/snap) handlers for HTTP [range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests).++This package provides a way to respond to an HTTP request for a particular range of bytes. Range requests include a header that specifies which bytes the client is requesting (e.g., `Range: bytes=0-1023`). See the documentation for `serveStreamAs`.
snap-stream.cabal view
@@ -1,23 +1,34 @@-Name: snap-stream-Version: 0.1-Synopsis: Streaming Snap handlers-Description: Snap handlers for streaming access with range requests-License: BSD3-License-file: LICENSE-Author: Obsidian Systems LLC-Maintainer: maintainer@obsidian.systems-Stability: Experimental-Category: Web-Build-type: Simple-Cabal-version: >= 1.6+name:               snap-stream+version:            0.1.1.0+synopsis:           Streaming Snap handlers+description:        Snap handlers for streaming access with range requests+license:            BSD3+license-file:       LICENSE+author:             Obsidian Systems LLC+maintainer:         maintainer@obsidian.systems+stability:          Experimental+category:           Web+build-type:         Simple+cabal-version:      >=1.10+extra-source-files:+  changelog.md+  readme.md  library-  hs-source-dirs: src-  build-depends: base >= 4.9 && < 4.12-               , attoparsec == 0.13.*-               , bytestring == 0.10.*-               , io-streams >= 1.4 && < 1.6-               , snap-core == 1.0.*-  exposed-modules: Snap.Util.FileServe.Stream+  hs-source-dirs:   src+  build-depends:+      attoparsec  >=0.13 && <0.14+    , base        >=4.9  && <4.15+    , bytestring  >=0.10 && <0.11+    , io-streams  >=1.4  && <1.6+    , snap-core   >=1.0  && <1.1 -  ghc-options: -Wall -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2+  exposed-modules:  Snap.Util.FileServe.Stream+  ghc-options:+    -Wall -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields++  default-language: Haskell2010++source-repository head+  type:     git+  location: https://github.com/obsidiansystems/snap-stream
src/Snap/Util/FileServe/Stream.hs view
@@ -1,9 +1,19 @@+{-|+Description:+  Handler for HTTP range requests++HTTP range requests include a header specifying the range of bytes expected in+the response. For example:++> Range: bytes=0-1023++See this <https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests+documentation> for more details on range requests.+-} {-# LANGUAGE BangPatterns        #-} {-# LANGUAGE CPP                 #-} {-# LANGUAGE OverloadedStrings   #-} {-# LANGUAGE ScopedTypeVariables #-}---- | Contains web handlers to stream files module Snap.Util.FileServe.Stream where  ------------------------------------------------------------------------------@@ -24,12 +34,22 @@   --------------------------------------------------------------------------------- | Same as 'serveFile', with control over the MIME mapping used and streamed+-- | Serves a file, with support for range requests and explicit mime type+-- specification.+--+-- This function can be used in the presence or absence of @Range@ headers: it+-- can be used to serve partial files and whole files.+--+-- Similar to 'serveFile'. serveStreamAs :: MonadSnap m-              => ByteString        -- ^ MIME type+              => ByteString+              -- ^ MIME type               -> Word64+              -- ^ The size of the file being streamed               -> (Word64 -> Word64 -> OutputStream Builder -> IO ())+              -- ^ If a partial range is requested, this function is used to send that range.               -> (OutputStream Builder -> IO ())+              -- ^ If a partial range is not requested, this function is used to send the whole file.               -> m () serveStreamAs mime sz stream streamAll = do     reqOrig <- getRequest