7
7
module Cardano.Api.IO
8
8
( OutputFile (.. )
9
9
10
+ , writeByteStringFileWithOwnerPermissions
10
11
, writeByteStringFile
11
12
, writeByteStringOutput
12
13
14
+ , writeLazyByteStringFileWithOwnerPermissions
13
15
, writeLazyByteStringFile
14
16
, writeLazyByteStringOutput
15
17
18
+ , writeTextFileWithOwnerPermissions
16
19
, writeTextFile
17
20
, writeTextOutput
18
21
19
- , writeLazyByteStringFileWithOwnerPermissions
20
22
) where
21
23
22
24
#if !defined(mingw32_HOST_OS)
@@ -108,6 +110,14 @@ writeByteStringFile :: MonadIO m => FilePath -> ByteString -> m (Either (FileErr
108
110
writeByteStringFile fp bs = runExceptT $
109
111
handleIOExceptT (FileIOError fp) $ BS. writeFile fp bs
110
112
113
+ writeByteStringFileWithOwnerPermissions
114
+ :: FilePath
115
+ -> BS. ByteString
116
+ -> IO (Either (FileError () ) () )
117
+ writeByteStringFileWithOwnerPermissions fp bs =
118
+ handleFileForWritingWithOwnerPermission fp $ \ h ->
119
+ BS. hPut h bs
120
+
111
121
writeByteStringOutput :: MonadIO m => Maybe FilePath -> ByteString -> m (Either (FileError () ) () )
112
122
writeByteStringOutput mOutput bs = runExceptT $
113
123
case mOutput of
@@ -118,6 +128,14 @@ writeLazyByteStringFile :: MonadIO m => FilePath -> LBS.ByteString -> m (Either
118
128
writeLazyByteStringFile fp bs = runExceptT $
119
129
handleIOExceptT (FileIOError fp) $ LBS. writeFile fp bs
120
130
131
+ writeLazyByteStringFileWithOwnerPermissions
132
+ :: FilePath
133
+ -> LBS. ByteString
134
+ -> IO (Either (FileError () ) () )
135
+ writeLazyByteStringFileWithOwnerPermissions fp lbs =
136
+ handleFileForWritingWithOwnerPermission fp $ \ h ->
137
+ LBS. hPut h lbs
138
+
121
139
writeLazyByteStringOutput :: MonadIO m => Maybe FilePath -> LBS. ByteString -> m (Either (FileError () ) () )
122
140
writeLazyByteStringOutput mOutput bs = runExceptT $
123
141
case mOutput of
@@ -128,16 +146,16 @@ writeTextFile :: MonadIO m => FilePath -> Text -> m (Either (FileError ()) ())
128
146
writeTextFile fp t = runExceptT $
129
147
handleIOExceptT (FileIOError fp) $ Text. writeFile fp t
130
148
149
+ writeTextFileWithOwnerPermissions
150
+ :: FilePath
151
+ -> Text
152
+ -> IO (Either (FileError () ) () )
153
+ writeTextFileWithOwnerPermissions fp t =
154
+ handleFileForWritingWithOwnerPermission fp $ \ h ->
155
+ Text. hPutStr h t
156
+
131
157
writeTextOutput :: MonadIO m => Maybe FilePath -> Text -> m (Either (FileError () ) () )
132
158
writeTextOutput mOutput t = runExceptT $
133
159
case mOutput of
134
160
Just fp -> handleIOExceptT (FileIOError fp) $ Text. writeFile fp t
135
161
Nothing -> liftIO $ Text. putStr t
136
-
137
- writeLazyByteStringFileWithOwnerPermissions
138
- :: FilePath
139
- -> LBS. ByteString
140
- -> IO (Either (FileError () ) () )
141
- writeLazyByteStringFileWithOwnerPermissions fp lbs =
142
- handleFileForWritingWithOwnerPermission fp $ \ h ->
143
- LBS. hPut h lbs
0 commit comments