Fs

Custom types

FsMetadataResult

type FsMetadataResult is bytes32;

Structs

FsMetadata

struct FsMetadata {
	bool isDir
	bool isSymlink
	uint256 length
	bool readOnly
	uint256 modified
	uint256 accessed
	uint256 created
}

Functions

Ok(FsMetadata value) → (FsMetadataResult)

fs

readFile(string path) → (StringResult)

Reads the file on path and returns its content as a StringResult.

readFileBinary(string path) → (BytesResult)

Reads the file on path and returns its content as a BytesResult.

projectRoot() → (StringResult)

Obtains the current project's root.

metadata(string fileOrDir) → (FsMetadataResult)

Obtains the metadata of the specified file or directory.

readLine(string path) → (StringResult)

Reads the next line of the file on path.

writeFile(string path, string data) → (EmptyResult)

Modifies the content of the file on path with data.

writeFileBinary(string path, bytes data) → (EmptyResult)

Modifies the content of the file on path with data.

writeLine(string path, string data) → (EmptyResult)

Adds a new line to the file on path.

closeFile(string path) → (EmptyResult)

Resets the state of the file on path.

removeFile(string path) → (EmptyResult)

Deletes the file on path.

copyFile(string origin, string target) → (EmptyResult)

Copies a file from origin to target.

moveFile(string origin, string target) → (EmptyResult)

Moves a file from origin to target.

fileExists(string path) → (BoolResult)

Checks if a file or directory exists.

getCode(string path) → (BytesResult)

Obtains the creation code from an artifact file located at path

getDeployedCode(string path) → (BytesResult)

Obtains the deployed code from an artifact file located at path

FsErrors

FailedToRead(string reason) → (Error)

FailedToReadLine(string reason) → (Error)

FailedToReadMetadata(string reason) → (Error)

FailedToGetProjectRoot(string reason) → (Error)

Forbidden(string reason) → (Error)

FailedToWrite(string reason) → (Error)

FailedToWriteLine(string reason) → (Error)

FailedToCloseFile(string reason) → (Error)

FailedToRemoveFile(string reason) → (Error)

FailedToGetCode(string reason) → (Error)

toFsMetadataResult(Error self) → (FsMetadataResult)

toEmptyResult(Error self) → (EmptyResult)

LibFsMetadataPointer

toFsMetadata(Pointer self) → (FsMetadata metadata)

toFsMetadataResult(Pointer self) → (FsMetadataResult ptr)

toPointer(FsMetadata self) → (Pointer ptr)

LibFsMetadataResult

isOk(FsMetadataResult self) → (bool)

isError(FsMetadataResult self) → (bool)

unwrap(FsMetadataResult self) → (FsMetadata val)

expect(FsMetadataResult self, string err) → (FsMetadata)

toError(FsMetadataResult self) → (Error)

toValue(FsMetadataResult self) → (FsMetadata val)

toPointer(FsMetadataResult self) → (Pointer)