How to create object from Arraybuffer

Hi,

I am loading fbx file from my local and reading it using FileReader. Output from the filereader is Arraybuffer .

ArrayBuffer(15211536)
byteLength: 15211536
[[Prototype]]: ArrayBuffer
[[Int8Array]]: Int8Array(15211536)
[[Uint8Array]]: Uint8Array(15211536)
[[Int16Array]]: Int16Array(7605768)
[[Int32Array]]: Int32Array(3802884)
[[ArrayBufferByteLength]]: 15211536
[[ArrayBufferData]]: 55092

I want to create threejs object out of it and add it to my scene . Can anyone please help me how can I achieve this . This fbx contains animation as well . Thanks in advance.

Like this?

import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader.js'

async loadFBX() {
  const loader = new FBXLoader()
  const reader = new FileReader()

  const res = await fetch('/assets/Idle.fbx')
  const blob = await res.blob()

  reader.onload = evt => {
    const result = evt.target?.result
    if (!result) return

    const group = loader.parse(result, '')
    this.scene.add(group)
  }

  reader.readAsArrayBuffer(blob)
}

This works , great . Thanks .

How can I align my object with scene coordinate ?

I uploaded one standing 3D character. but it uploaded in the scene like lying down . Do I have to manually rotate each object after loading ? can I automatically fix the rotation of object while uploading itself ?