Sha256: 6b4362382250159e647b471fc4d17fa0d4aab3dd28f050c9d75a18054f74b948
Contents?: true
Size: 635 Bytes
Versions: 26
Compression:
Stored size: 635 Bytes
Contents
const encoder = new TextEncoder() export function encodeBuffer(text: string): Uint8Array { return encoder.encode(text) } export function decodeBuffer(buffer: ArrayBuffer, encoding?: string): string { const decoder = new TextDecoder(encoding) return decoder.decode(buffer) } /** * Create an `ArrayBuffer` from the given `Uint8Array`. * Takes the byte offset into account to produce the right buffer * in the case when the buffer is bigger than the data view. */ export function toArrayBuffer(array: Uint8Array): ArrayBuffer { return array.buffer.slice( array.byteOffset, array.byteOffset + array.byteLength ) }
Version data entries
26 entries across 26 versions & 1 rubygems