Skip to main content

Filesystem APIs

The artemis API contains several functions that can be used to interact with the filesystem.

stat(path) -> FileInfo | FileError

Return basic metadata about a file or directory

ParamTypeDescription
pathstringFile or directory to get metadata about

hash(path, md5, sha1, sha256) -> Hashes | FileError

Return hashes for a single file

ParamTypeDescription
pathstringFile to hash
md5booleanEnable MD5 hashing
sha1booleanEnable SHA1 hashing
sha256booleanEnable SHA256 hashing

readTextFile(path) -> string | FileError

Read a text file. Currently only files less than 2GB in size can be read

ParamTypeDescription
pathstringText file to read

readFile(path) -> Uint8Array | FileError

Read a file using regular OS APIs. Currently only files less than 2GB in size can be read

ParamTypeDescription
pathstringFile to read

glob(pattern) -> GlobInfo[] | FileError

Parse glob patterns based on Rust glob support

ParamTypeDescription
patternstringGlob pattern to parse. Ex: C:\* to get all files and directories at Windows C directory

readDir(path) -> Promise<FileInfo[]> | FileError

Read a provided directory and get list of files. This function is async!

ParamTypeDescription
pathstringDirectory to read

acquireFile(path, output) -> boolean | FileError

Acquire a local file using OS APIs. Supports copying the file to local location or uploading to cloud.

ParamTypeDescription
pathstringDirectory to read
outputOutputOutput object

readLines(path, offset, limit) -> string[] | FileError

Read lines from a text file. You may provide an offset to specific line and limit the number of lines to read.

ParamTypeDescription
pathstringText file to read
offsetnumberLine to start reading file at. Must be positive number. Default is 0.
limitnumberHow many lines to read. Must be positive number. Default is 100.