1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE ScopedTypeVariables #-}
5-- Module : Example.Storage
6-- Copyright : (c) 2015-2016 Brendan Hay
7-- License : Mozilla Public License, v. 2.0.
8-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
9-- Stability : provisional
10-- Portability : non-portable (GHC extensions)
12module Example.Storage where
14import Control.Lens ((&), (.~), (<&>), (?~))
15import Data.Text (Text)
17import Network.Google.Storage
18import System.IO (stdout)
20import qualified Data.Text as Text
22-- This will calculate the MIME type (and therefore Content-Type) of
23-- the stored object based on the file extension.
25-- You can explicitly set the desired MIME type by using:
27-- import Network.HTTP.Media ((//))
29-- b <- sourceBody f <&> bodyContentType .~ "application" // "json"
33example :: Text -> FilePath -> IO ()
35 l <- newLogger Debug stdout
36 e <- newEnv <&> (envLogger .~ l) . (envScopes .~ storageReadWriteScope)
41 runResourceT . runGoogle e $ do
42 _ <- upload (objectsInsert bkt object' & oiName ?~ key) b
43 _ <- download (objectsGet bkt key)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list