-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
859 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,8 @@ | ||
module Node.FS | ||
( FileDescriptor | ||
, FileMode | ||
, SymlinkType(..) | ||
, symlinkTypeToNode | ||
, BufferLength | ||
, BufferOffset | ||
, ByteCount | ||
, FilePosition | ||
, module Exports | ||
) where | ||
module Node.FS (module Exports) where | ||
|
||
import Prelude | ||
|
||
import Data.Nullable (Nullable) | ||
import Data.Nullable as Nullable | ||
import Node.FS.Constants (FileFlags(..), fileFlagsToNode) as Exports | ||
|
||
foreign import data FileDescriptor :: Type | ||
|
||
type FileMode = Int | ||
type FilePosition = Int | ||
type BufferLength = Int | ||
type BufferOffset = Int | ||
type ByteCount = Int | ||
|
||
-- | Symlink varieties. | ||
data SymlinkType = FileLink | DirLink | JunctionLink | AutodetectLink | ||
|
||
-- | Convert a `SymlinkType` to a `String` in the format expected by the | ||
-- | Node.js filesystem API. | ||
symlinkTypeToNode :: SymlinkType -> Nullable String | ||
symlinkTypeToNode ty = case ty of | ||
FileLink -> Nullable.notNull "file" | ||
DirLink -> Nullable.notNull "dir" | ||
JunctionLink -> Nullable.notNull "junction" | ||
AutodetectLink -> Nullable.null | ||
|
||
instance showSymlinkType :: Show SymlinkType where | ||
show FileLink = "FileLink" | ||
show DirLink = "DirLink" | ||
show JunctionLink = "JunctionLink" | ||
show AutodetectLink = "AutodetectLink" | ||
|
||
derive instance eqSymlinkType :: Eq SymlinkType | ||
import Node.FS.Types as Exports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.