0.1.0 • Published 3 years ago

tree-file-system v0.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

File System Tree

File system tree implementation in JavaScript

FileSystem API

MethodReturn typeDescription
copy()FileSystemmake copy of entire file system
getFile()Filereturns file if exists
getDirectory()Directoryreturns directory if exists
getItem()Itemreturns file or directory if exists
createFile()File
createDirectory()Directory
removeFile()booleanthrows exception if file is not found
removeDirectory()booleanthrows execption if directory is not found
removeItem()booleanthrows exception if neither file nor directory is found

Directory API

MethodReturn typeDescription
namestringdirectory name
pathstringabsolute path of directory
parentDirectoryparent directory
copy()Directorymake copy of directory
hasItem()boolean
getItem()Item
getItems()Item[]
appendItem()booleantrue if new item is appended
replaceItem()booleantrue if old item is replaced
appendOrReplaceItem()booleantrue if new item is appended, otherwise item is replaced
removeItem()booleantrue if item removed
findItemFromPath()Item
remove()booleanremoves current directory from file system
moveTo()booleanmoves current directory to given item

RootDirectory API

Inherits Directory methods, except

PropertyValue
name""
path"/"
parentundefined

File API

MethodReturn typeDescription
namestringfile name
pathstringabsolute path of file
parentDirectoryparent directory
copy()Filereturns copy of current file
remove()booleanremoves file from file system
moveTo()booleanmoves file to given directory