Loading lib/RD/Lib.hs +6 −2 Original line number Diff line number Diff line Loading @@ -19,8 +19,12 @@ import RD.Types -- | convert byte number to MiB. small number will become 0. humanReadableSize :: Integer -> T.Text humanReadableSize bytes = sformat (fixed 1 % " MiB") (fromInteger bytes / (1048576 :: Double)) humanReadableSize bytes = let bytesDouble = fromInteger bytes / (1048576 :: Double) in if bytesDouble < 1.0 then "<1.0 MiB" else sformat (fixed 1 % " MiB") bytesDouble -- | get sha1sum hex string for given bytes sha1sumOnBytes :: LB.ByteString -> LB.ByteString Loading operational +6 −1 Original line number Diff line number Diff line Loading @@ -495,8 +495,13 @@ via env var and command line parameter. * current :entry: ** ** 2024-04-26 log refine. - 2024-04-26T19:06:17 I fileWorker done for /home/sylecn/d/t2/foo, 0.0 MiB, 1 blocks - DONE 2024-04-26T19:06:17 I fileWorker done for /home/sylecn/d/t2/foo, 0.0 MiB, 1 blocks don't use 0.0MiB, just say <1MiB or so. humanReadableSize add unit test for this. - 2024-04-26T19:12:02 I fileWorker is waiting for jobs... 2024-04-26T19:12:02 I fileWorker is waiting for jobs... Loading package.yaml +1 −1 Original line number Diff line number Diff line name: reliable-download # do not modify version if lib/ code is not changed. # real app version: 1.3.0.0 # real app version: 1.3.1.0 version: 1.2.6.0 synopsis: provide reliable download service via HTTP description: reliable-download web application and cli tool Loading pypi/rd-api/README.rst +1 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ ChangeLog * dev - feature: auto detect file content changes for small files. auto invalidate metadata cache if file has changed. - feature: refine fileWorker logs * v1.5.0.0 2024-04-08 Loading test/TestApi.hs +1 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ spec = do describe "humanReadableSize" $ do it "should work" $ do humanReadableSize 123 `shouldBe` "0.0 MiB" humanReadableSize 123 `shouldBe` "<1.0 MiB" humanReadableSize 1048576 `shouldBe` "1.0 MiB" humanReadableSize 1048579 `shouldBe` "1.0 MiB" humanReadableSize (1048576 * 2) `shouldBe` "2.0 MiB" Loading Loading
lib/RD/Lib.hs +6 −2 Original line number Diff line number Diff line Loading @@ -19,8 +19,12 @@ import RD.Types -- | convert byte number to MiB. small number will become 0. humanReadableSize :: Integer -> T.Text humanReadableSize bytes = sformat (fixed 1 % " MiB") (fromInteger bytes / (1048576 :: Double)) humanReadableSize bytes = let bytesDouble = fromInteger bytes / (1048576 :: Double) in if bytesDouble < 1.0 then "<1.0 MiB" else sformat (fixed 1 % " MiB") bytesDouble -- | get sha1sum hex string for given bytes sha1sumOnBytes :: LB.ByteString -> LB.ByteString Loading
operational +6 −1 Original line number Diff line number Diff line Loading @@ -495,8 +495,13 @@ via env var and command line parameter. * current :entry: ** ** 2024-04-26 log refine. - 2024-04-26T19:06:17 I fileWorker done for /home/sylecn/d/t2/foo, 0.0 MiB, 1 blocks - DONE 2024-04-26T19:06:17 I fileWorker done for /home/sylecn/d/t2/foo, 0.0 MiB, 1 blocks don't use 0.0MiB, just say <1MiB or so. humanReadableSize add unit test for this. - 2024-04-26T19:12:02 I fileWorker is waiting for jobs... 2024-04-26T19:12:02 I fileWorker is waiting for jobs... Loading
package.yaml +1 −1 Original line number Diff line number Diff line name: reliable-download # do not modify version if lib/ code is not changed. # real app version: 1.3.0.0 # real app version: 1.3.1.0 version: 1.2.6.0 synopsis: provide reliable download service via HTTP description: reliable-download web application and cli tool Loading
pypi/rd-api/README.rst +1 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ ChangeLog * dev - feature: auto detect file content changes for small files. auto invalidate metadata cache if file has changed. - feature: refine fileWorker logs * v1.5.0.0 2024-04-08 Loading
test/TestApi.hs +1 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ spec = do describe "humanReadableSize" $ do it "should work" $ do humanReadableSize 123 `shouldBe` "0.0 MiB" humanReadableSize 123 `shouldBe` "<1.0 MiB" humanReadableSize 1048576 `shouldBe` "1.0 MiB" humanReadableSize 1048579 `shouldBe` "1.0 MiB" humanReadableSize (1048576 * 2) `shouldBe` "2.0 MiB" Loading