from
abstract fun from(source: PolyglotValue, offset: Int? = null, length: Int? = null, encoding: String? = null): BufferInstance
Allocate a new buffer and fill it using the data from the given source. The source may be a simple integer[]
array, Buffer or UInt8Array instance, in which case other parameters are ignored; an ArrayBuffer
or SharedArrayBuffer
, which allow setting an offset and length for the data to copy; or a string, which is converted to bytes using the encoding.
Using objects as a source is not yet supported.