Skip to content

michaelficarra/purescript-node-fs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Module Documentation

Module Node.FS

FS

data FS :: !

SymlinkType

data SymlinkType
  = FileLink 
  | DirLink 
  | JunctionLink 

showSymlinkType

instance showSymlinkType :: Show SymlinkType

eqSymlinkType

instance eqSymlinkType :: Eq SymlinkType

Module Node.FS.Async

Callback

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

rename

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

truncate

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

chown

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

chmod

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

stat

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

link

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

symlink

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

readlink

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

realpath

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

realpath'

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

unlink

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

rmdir

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

mkdir

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

mkdir'

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

readdir

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

utimes

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

readFile

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

readTextFile

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

writeFile

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

writeTextFile

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

appendFile

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

appendTextFile

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

exists

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

Module Node.FS.Perms

Perm

newtype Perm

A Perm value specifies what is allowed to be done with a particular file by a particular class of user β€” that is, whether it is readable, writable, and/or executable. It has a semigroup instance, which allows you to combine permissions; for example, read <> write means "readable and writable".

eqPerm

instance eqPerm :: Eq Perm

ordPerm

instance ordPerm :: Ord Perm

showPerm

instance showPerm :: Show Perm

semigroupPerm

instance semigroupPerm :: Semigroup Perm

none

none :: Perm

No permissions. This is the identity of the Semigroup operation (<>) for Perm.

read

read :: Perm

The "readable" permission.

write

write :: Perm

The "writable" permission.

execute

execute :: Perm

The "executable" permission.

all

all :: Perm

All permissions: readable, writable, and executable.

Perms

newtype Perms

A Perms value includes all the permissions information about a particular file or directory, by storing a Perm value for each of the file owner, the group, and any other users.

eqPerms

instance eqPerms :: Eq Perms

ordPerms

instance ordPerms :: Ord Perms

showPerms

instance showPerms :: Show Perms

permsFromString

permsFromString :: String -> Maybe Perms

Attempt to parse a Perms value from a String containing an octal integer. For example, permsFromString "0644" == Just (mkPerms (read <> write) read read).

mkPerms

mkPerms :: Perm -> Perm -> Perm -> Perms

Create a Perms value. The arguments represent the owner's, group's, and other users' permission sets, respectively.

permsToString

permsToString :: Perms -> String

Convert a Perms value to an octal string, in a format similar to that accepted by chmod. For example: permsToString (mkPerms (read <> write) read read) == "0644"

permsToInt

permsToInt :: Perms -> Int

Convert a Perms value to an Int, via permsToString.

Module Node.FS.Stats

StatsObj

type StatsObj = { isSocket :: Fn0 Boolean, isFIFO :: Fn0 Boolean, isCharacterDevice :: Fn0 Boolean, isBlockDevice :: Fn0 Boolean, isDirectory :: Fn0 Boolean, isFile :: Fn0 Boolean, ctime :: JSDate, mtime :: JSDate, atime :: JSDate, size :: Number, ino :: Number, rdev :: Number, gid :: Number, uid :: Number, nlink :: Number, mode :: Number, dev :: Number }

Stats

data Stats
  = Stats StatsObj

showStats

instance showStats :: Show Stats

isFile

isFile :: Stats -> Boolean

isDirectory

isDirectory :: Stats -> Boolean

isBlockDevice

isBlockDevice :: Stats -> Boolean

isCharacterDevice

isCharacterDevice :: Stats -> Boolean

isFIFO

isFIFO :: Stats -> Boolean

isSocket

isSocket :: Stats -> Boolean

isSymbolicLink

isSymbolicLink :: Stats -> Boolean

accessedTime

accessedTime :: Stats -> Date

modifiedTime

modifiedTime :: Stats -> Date

statusChangedTime

statusChangedTime :: Stats -> Date

Module Node.FS.Sync

FileDescriptor

data FileDescriptor :: *

FileFlags

data FileFlags
  = R 
  | R_PLUS 
  | RS 
  | RS_PLUS 
  | W 
  | WX 
  | W_PLUS 
  | WX_PLUS 
  | A 
  | AX 
  | A_PLUS 
  | AX_PLUS 

BufferLength

type BufferLength = Number

BufferOffset

type BufferOffset = Number

ByteCount

type ByteCount = Number

FileMode

type FileMode = Number

FilePosition

type FilePosition = Number

rename

rename :: forall eff. FilePath -> FilePath -> Eff (err :: Exception, fs :: FS | eff) Unit

truncate

truncate :: forall eff. FilePath -> Number -> Eff (err :: Exception, fs :: FS | eff) Unit

chown

chown :: forall eff. FilePath -> Number -> Number -> Eff (err :: Exception, fs :: FS | eff) Unit

chmod

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

stat

stat :: forall eff. FilePath -> Eff (err :: Exception, fs :: FS | eff) Stats

link

link :: forall eff. FilePath -> FilePath -> Eff (err :: Exception, fs :: FS | eff) Unit

symlink

symlink :: forall eff. FilePath -> FilePath -> SymlinkType -> Eff (err :: Exception, fs :: FS | eff) Unit

readlink

readlink :: forall eff. FilePath -> Eff (err :: Exception, fs :: FS | eff) FilePath

realpath

realpath :: forall eff. FilePath -> Eff (err :: Exception, fs :: FS | eff) FilePath

realpath'

realpath' :: forall eff cache. FilePath -> {  | cache } -> Eff (err :: Exception, fs :: FS | eff) FilePath

unlink

unlink :: forall eff. FilePath -> Eff (err :: Exception, fs :: FS | eff) Unit

rmdir

rmdir :: forall eff. FilePath -> Eff (err :: Exception, fs :: FS | eff) Unit

mkdir

mkdir :: forall eff. FilePath -> Eff (err :: Exception, fs :: FS | eff) Unit

mkdir'

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

readdir

readdir :: forall eff. FilePath -> Eff (err :: Exception, fs :: FS | eff) [FilePath]

utimes

utimes :: forall eff. FilePath -> Date -> Date -> Eff (err :: Exception, fs :: FS | eff) Unit

readFile

readFile :: forall eff. FilePath -> Eff (err :: Exception, fs :: FS | eff) Buffer

readTextFile

readTextFile :: forall eff. Encoding -> FilePath -> Eff (err :: Exception, fs :: FS | eff) String

writeFile

writeFile :: forall eff. FilePath -> Buffer -> Eff (err :: Exception, fs :: FS | eff) Unit

writeTextFile

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

appendFile

appendFile :: forall eff. FilePath -> Buffer -> Eff (err :: Exception, fs :: FS | eff) Unit

appendTextFile

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

exists

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

fdOpen

fdOpen :: forall opts eff. FilePath -> FileFlags -> Maybe FileMode -> Eff (fs :: FS, err :: Exception | eff) FileDescriptor

fdRead

fdRead :: forall eff. FileDescriptor -> Buffer -> BufferOffset -> BufferLength -> Maybe FilePosition -> Eff (fs :: FS, err :: Exception | eff) ByteCount

fdNext

fdNext :: forall eff. FileDescriptor -> Buffer -> Eff (fs :: FS, err :: Exception | eff) ByteCount

fdWrite

fdWrite :: forall eff. FileDescriptor -> Buffer -> BufferOffset -> BufferLength -> Maybe FilePosition -> Eff (fs :: FS, err :: Exception | eff) ByteCount

fdAppend

fdAppend :: forall eff. FileDescriptor -> Buffer -> Eff (fs :: FS, err :: Exception | eff) ByteCount

fdFlush

fdFlush :: forall eff. FileDescriptor -> Eff (fs :: FS, err :: Exception | eff) Unit

fdClose

fdClose :: forall eff. FileDescriptor -> Eff (fs :: FS, err :: Exception | eff) Unit

About

Node.js file I/O for purescript

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PureScript 97.2%
  • JavaScript 2.8%