Module

Node.FS.Async

Package
purescript-node-fs
Repository
purescript-node/purescript-node-fs

#Callback Source

type Callback eff a = Either Error a -> Eff (fs :: FS | eff) Unit

Type synonym for callback functions.

#rename Source

rename :: forall eff. FilePath -> FilePath -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Renames a file.

#truncate Source

truncate :: forall eff. FilePath -> Int -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Truncates a file to the specified length.

#chown Source

chown :: forall eff. FilePath -> Int -> Int -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Changes the ownership of a file.

#chmod Source

chmod :: forall eff. FilePath -> Perms -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Changes the permissions of a file.

#stat Source

stat :: forall eff. FilePath -> Callback eff Stats -> Eff (fs :: FS | eff) Unit

Gets file statistics.

#realpath Source

realpath :: forall eff. FilePath -> Callback eff FilePath -> Eff (fs :: FS | eff) Unit

Find the canonicalized absolute location for a path.

#realpath' Source

realpath' :: forall cache eff. FilePath -> Record cache -> Callback eff FilePath -> Eff (fs :: FS | eff) Unit

Find the canonicalized absolute location for a path using a cache object for already resolved paths.

#rmdir Source

rmdir :: forall eff. FilePath -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Deletes a directory.

#mkdir Source

mkdir :: forall eff. FilePath -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Makes a new directory.

#mkdir' Source

mkdir' :: forall eff. FilePath -> Perms -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Makes a new directory with the specified permissions.

#readdir Source

readdir :: forall eff. FilePath -> Callback eff (Array FilePath) -> Eff (fs :: FS | eff) Unit

Reads the contents of a directory.

#utimes Source

utimes :: forall eff. FilePath -> DateTime -> DateTime -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Sets the accessed and modified times for the specified file.

#readFile Source

readFile :: forall eff. FilePath -> Callback (buffer :: BUFFER | eff) Buffer -> Eff (buffer :: BUFFER, fs :: FS | eff) Unit

Reads the entire contents of a file returning the result as a raw buffer.

#readTextFile Source

readTextFile :: forall eff. Encoding -> FilePath -> Callback eff String -> Eff (fs :: FS | eff) Unit

Reads the entire contents of a text file with the specified encoding.

#writeFile Source

writeFile :: forall eff. FilePath -> Buffer -> Callback (buffer :: BUFFER | eff) Unit -> Eff (buffer :: BUFFER, fs :: FS | eff) Unit

Writes a buffer to a file.

#writeTextFile Source

writeTextFile :: forall eff. Encoding -> FilePath -> String -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Writes text to a file using the specified encoding.

#appendFile Source

appendFile :: forall eff. FilePath -> Buffer -> Callback (buffer :: BUFFER | eff) Unit -> Eff (buffer :: BUFFER, fs :: FS | eff) Unit

Appends the contents of a buffer to a file.

#appendTextFile Source

appendTextFile :: forall eff. Encoding -> FilePath -> String -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Appends text to a file using the specified encoding.

#exists Source

exists :: forall eff. FilePath -> (Boolean -> Eff (fs :: FS | eff) Unit) -> Eff (fs :: FS | eff) Unit

Check if the path exists.

#fdOpen Source

fdOpen :: forall eff. FilePath -> FileFlags -> Maybe FileMode -> Callback eff FileDescriptor -> Eff (fs :: FS | eff) Unit

Open a file asynchronously. See the Node Documentation for details.

#fdRead Source

fdRead :: forall eff. FileDescriptor -> Buffer -> BufferOffset -> BufferLength -> Maybe FilePosition -> Callback (buffer :: BUFFER | eff) ByteCount -> Eff (buffer :: BUFFER, fs :: FS | eff) Unit

Read from a file asynchronously. See the Node Documentation for details.

#fdNext Source

fdNext :: forall eff. FileDescriptor -> Buffer -> Callback (buffer :: BUFFER | eff) ByteCount -> Eff (buffer :: BUFFER, fs :: FS | eff) Unit

Convenience function to fill the whole buffer from the current file position.

#fdWrite Source

fdWrite :: forall eff. FileDescriptor -> Buffer -> BufferOffset -> BufferLength -> Maybe FilePosition -> Callback (buffer :: BUFFER | eff) ByteCount -> Eff (buffer :: BUFFER, fs :: FS | eff) Unit

Write to a file asynchronously. See the Node Documentation for details.

#fdAppend Source

fdAppend :: forall eff. FileDescriptor -> Buffer -> Callback (buffer :: BUFFER | eff) ByteCount -> Eff (buffer :: BUFFER, fs :: FS | eff) Unit

Convenience function to append the whole buffer to the current file position.

#fdClose Source

fdClose :: forall eff. FileDescriptor -> Callback eff Unit -> Eff (fs :: FS | eff) Unit

Close a file asynchronously. See the Node Documentation for details.