happy-rusty
    Preparing search index...

    Type Alias AsyncIOResult<T>

    AsyncIOResult: AsyncResult<T, Error>

    Represents an asynchronous I/O operation that yields a Result<T, Error>. This is a promise that resolves to Ok(T) if the I/O operation was successful, or Err(Error) if there was an error.

    Type Parameters

    • T

      The type of the value that is produced by a successful I/O operation.

    1.0.0

    async function readFile(path: string): AsyncIOResult<string> {
    try {
    const content = await fs.readFile(path, 'utf-8');
    return Ok(content);
    } catch (e) {
    return Err(e as Error);
    }
    }