Skip to content

Latest commit

 

History

History
107 lines (97 loc) · 8.03 KB

README.md

File metadata and controls

107 lines (97 loc) · 8.03 KB

happy-opfsDocs


happy-opfs

Interfaces

Interface Description
CopyOptions Options for copy.
DownloadFileTempResponse Result of downloadFile when the file is saved to a temporary path.
ErrorLike Serializable version of Error.
ExistsOptions Options to determine the existence of a file or directory.
FileLike Serializable version of File.
FileSystemFileHandleLike A handle to a file or directory returned by statSync.
FileSystemHandleLike A handle to a file or directory returned by statSync.
MoveOptions Options for move.
ReadDirEntry An entry returned by readDir.
ReadDirEntrySync An entry returned by readDirSync.
ReadDirOptions Options for reading directories.
ReadOptions Options for reading files with specified encoding.
SyncAgentOptions Setup options of connectSyncAgent.
TempOptions Options for mkTemp.
UploadRequestInit fetch-t request options for uploading files.
WriteOptions Options for writing files, including flags for creation and appending.
ZipOptions Options for zip.

Type Aliases

Type alias Description
FileEncoding Supported file encodings for reading and writing files.
FsRequestInit fetch-t options for download and upload.
ReadFileContent Represents the possible content types that can be read from a file.
WriteFileContent Represents the possible content types that can be written to a file.
WriteSyncFileContent Represents the possible content types that can be written synchronously to a file.

Variables

Variable Description
CURRENT_DIR A constant representing the current directory path.
NOT_FOUND_ERROR A constant representing the error thrown when a file or directory is not found. Name of DOMException.NOT_FOUND_ERR.
ROOT_DIR A constant representing the root directory path.
TMP_DIR A constant representing the temporary directory path.

Functions

Function Description
appendFile Appends content to a file at the specified path.
appendFileSync Sync version of appendFile.
assertAbsolutePath Asserts that the provided path is an absolute path.
assertFileUrl Asserts that the provided URL is a valid file URL.
connectSyncAgent Communicate with worker.
copy Copies a file or directory from one location to another same as cp -r.
copySync Sync version of copy.
createFile Creates a new file at the specified path same as touch.
createFileSync Sync version of createFile.
deleteTemp Delete the temporary directory and all its contents.
deleteTempSync Sync version of deleteTemp.
downloadFile Downloads a file from a URL and saves it to a temporary file. The returned response will contain the temporary file path.
emptyDir Empties the contents of a directory at the specified path.
emptyDirSync Sync version of emptyDir.
exists Checks whether a file or directory exists at the specified path.
existsSync Sync version of exists.
generateTempPath Generate a temporary path but not create it.
getFileDataByHandle Gets the data of a file handle.
isDirectoryHandle Whether the handle is a directory.
isFileHandle Whether the handle is a file.
isFileHandleLike Whether the handle is a file-like.
isOPFSSupported Checks if the Origin Private File System (OPFS) is supported in the current environment.
isTempPath Check whether the path is a temporary path.
mkTemp Create a temporary file or directory.
mkTempSync Sync version of mkTemp.
mkdir Creates a new directory at the specified path same as mkdir -p.
mkdirSync Sync version of mkdir.
move Move a file or directory from an old path to a new path.
moveSync Sync version of move.
pruneTemp Prune the temporary directory and delete all expired files.
pruneTempSync Sync version of pruneTemp.
readBlobFile Reads the content of a file at the specified path as a File.
readBlobFileSync Sync version of readBlobFile.
readDir Reads the contents of a directory at the specified path.
readDirSync Sync version of readDir.
readFile Reads the content of a file at the specified path as a File.
readFileSync Sync version of readFile.
readJsonFile Reads the content of a file at the specified path as a string and returns it as a JSON object.
readJsonFileSync Sync version of readJsonFile.
readTextFile Reads the content of a file at the specified path as a string.
readTextFileSync Sync version of readTextFile.
remove Removes a file or directory at the specified path same as rm -rf.
removeSync Sync version of remove.
startSyncAgent Start worker agent. Listens to postMessage from main thread. Start runner loop.
stat Retrieves the status of a file or directory at the specified path.
statSync Sync version of stat.
toFileSystemHandleLike Serialize a FileSystemHandle to plain object.
unzip Unzip a zip file to a directory. Equivalent to `unzip -o -d
unzipFromUrl Unzip a remote zip file to a directory. Equivalent to `unzip -o -d
unzipSync Sync version of unzip.
uploadFile Uploads a file from the specified path to a URL.
writeFile Writes content to a file at the specified path.
writeFileSync Sync version of writeFile.
zip Zip a file or directory and write to a zip file. Equivalent to zip -r <zipFilePath> <targetPath>.
zipFromUrl Zip a remote file and write to a zip file.
zipSync Sync version of zip.