Hi Apirak,
If you’re using the node object from a Figma Plugin, I highly recommend using this function:
import { extractLinearGradientParamsFromTransform } from "@figma-plugin/helpers";
If you’re using the Figma API, it’s a little more tedious. I implemented this before (its not always perfect, the angle gets messed up sometimes), but you can check out my code here.
I hope this helps