Skip to content

toArrayBuffer ​

将 File 对象转换为 ArrayBuffer。

使用 ​

ts
import { toArrayBuffer } from 'rattail'

await toArrayBuffer(new File(['Hello, world!'], 'hello.txt', { type: 'text/plain' }))
// return ArrayBuffer

参数 ​

参数类型默认值
fileFile

返回值 ​

类型
Promise<ArrayBuffer>