Skip to content

Commit

Permalink
fix formatting in example
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Jul 24, 2019
1 parent ce049c4 commit 3091cff
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/Brotli.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,29 @@ module Brotli exposing (decode)
Brotli is a compression algorithm much like the one zip archives use, but better: it is faster, more compact, and specifically geared towards web content and English text.
This package decodes `Bytes` sequences that are compressed with the brotli algorithm:
import Brotli
import Bytes exposing (Bytes)
import Bytes.Encode as Encode
import Bytes.Decode as Decode
import Brotli
import Bytes.Encode as Encode
bytes : List Int
bytes =
[ 27, 14, 0, 248, 37, 20, 82, 144, 66, 20, 169, 91, 100, 234, 20, 193 ]
[ 27, 14, 0, 248, 37, 20, 82, 144, 66, 20, 169, 91, 100, 234, 20, 193 ]
buffer : Bytes
buffer =
bytes
|> List.map Encode.unsignedInt8
|> Encode.sequence
|> Encode.encode
bytes
|> List.map Encode.unsignedInt8
|> Encode.sequence
|> Encode.encode
result : Maybe String
result =
Brotli.decode buffer
|> Result.toMaybe
|> Maybe.andThen (\\v -> Decode.decode (Decode.string (Bytes.width v)) v)
--> Just "this is a test\\n"
Brotli.decode buffer
|> Result.toMaybe
|> Maybe.andThen (\v -> Decode.decode (Decode.string (Bytes.width v)) v)
--> Just "this is a test\n"
## Decode
Expand Down

0 comments on commit 3091cff

Please sign in to comment.