@@ -14,6 +14,7 @@ module Node.FS.Sync
1414 , mkdir
1515 , mkdir'
1616 , readdir
17+ , utimes
1718 , readFile
1819 , readTextFile
1920 , writeFile
@@ -22,6 +23,7 @@ module Node.FS.Sync
2223
2324import Control.Monad.Eff
2425import Control.Monad.Eff.Exception
26+ import Data.Date
2527import Data.Function
2628import Node.Buffer (Buffer (..))
2729import Node.Encoding
@@ -44,6 +46,7 @@ foreign import fs "var fs = require('fs');" ::
4446 , rmdirSync :: Fn1 FilePath Unit
4547 , mkdirSync :: Fn2 FilePath Number Unit
4648 , readdirSync :: Fn1 FilePath [FilePath ]
49+ , utimesSync :: Fn3 FilePath Number Number Unit
4750 , readFileSync :: forall a opts . Fn2 FilePath { | opts } a
4851 , writeFileSync :: forall a opts . Fn3 FilePath a { | opts } Unit
4952 }
@@ -198,6 +201,19 @@ readdir :: forall eff. FilePath
198201readdir file = mkEff $ \_ -> runFn1
199202 fs.readdirSync file
200203
204+ -- |
205+ -- Sets the accessed and modified times for the specified file.
206+ --
207+ utimes :: forall eff . FilePath
208+ -> Date
209+ -> Date
210+ -> Eff (fs :: FS , err :: Exception Error | eff ) Unit
211+
212+ utimes file atime mtime = mkEff $ \_ -> runFn3
213+ fs.utimesSync file
214+ ((toEpochMilliseconds atime) / 1000 )
215+ ((toEpochMilliseconds mtime) / 1000 )
216+
201217-- |
202218-- Reads the entire contents of a file returning the result as a raw buffer.
203219--
0 commit comments