Skip to content

toArrayBuffer — @gj-kit/expo-media

A public function from @gj-kit/expo-media/testing. The signature below is taken directly from the 0.6.1 release declaration.

import { toArrayBuffer } from '@gj-kit/expo-media/testing';
/**
* `Uint8Array` → 독립 `ArrayBuffer`.
*
* `bytes.buffer`를 그대로 쓰지 않는 이유 둘: (i) `subarray` 결과는 **버퍼를 공유**해
* 호출자가 페이크 내부 바이트를 뒤에서 고칠 수 있고, (ii) TS 5.7+의 `ArrayBufferLike`
* 타입 파라미터화 때문에 `Uint8Array.buffer`가 `ArrayBuffer`로 좁혀지지 않는 조합이 있다.
* 새 버퍼에 복사하면 두 문제가 동시에 사라지고 캐스트도 필요 없다.
*/
declare function toArrayBuffer(bytes: Uint8Array): ArrayBuffer;

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/expo-media
  • Version: 0.6.1
  • Public entry: ./testing
  • Source: GitHub