@adviser/cement - v0.0.0
    Preparing search index...

    Function asyncCoerceIntoUint8

    • Asynchronously coerces various binary types including Blob into Uint8Array.

      Handles all types supported by coerceIntoUint8 plus async operations:

      • Promise-wrapped values
      • Blob (converts via arrayBuffer())
      • Result-wrapped Promises

      Parameters

      • raw: AsyncToUInt8

        Binary data or Promise thereof (including Blob)

      Returns Promise<Result<Uint8Array<ArrayBufferLike>, Error>>

      Promise resolving to Result.Ok with Uint8Array or Result.Err

      // Blob support
      const blob = new Blob(['Hello, World!']);
      const result1 = await asyncCoerceIntoUint8(blob);
      if (result1.isOk()) {
      const bytes = result1.unwrap();
      }

      // Promise-wrapped
      const promise = fetch('/data').then(r => r.arrayBuffer());
      const result2 = await asyncCoerceIntoUint8(promise);

      // Result-wrapped Promise
      const wrapped = Promise.resolve(Result.Ok(new ArrayBuffer(10)));
      const result3 = await asyncCoerceIntoUint8(wrapped);