use file-io for readFile/writeFile/appendFile on ByteStrings

These are all straightforward, and easy small performance wins.

Sponsored-by: Nicholas Golder-Manning
This commit is contained in:
Joey Hess 2025-01-22 14:30:25 -04:00
parent 90cd3aad37
commit 9b79f0f43d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
19 changed files with 63 additions and 52 deletions

View file

@ -39,7 +39,7 @@ import qualified Data.ByteString as S
#ifdef WITH_TORRENTPARSER
import Data.Torrent
import qualified Data.ByteString.Lazy as B
import qualified Utility.FileIO as F
#endif
remote :: RemoteType
@ -366,7 +366,7 @@ torrentFileSizes :: RawFilePath -> IO [(FilePath, Integer)]
torrentFileSizes torrent = do
#ifdef WITH_TORRENTPARSER
let mkfile = joinPath . map (scrub . decodeBL)
b <- B.readFile (fromRawFilePath torrent)
b <- F.readFile (toOsPath torrent)
return $ case readTorrent b of
Left e -> giveup $ "failed to parse torrent: " ++ e
Right t -> case tInfo t of