// Type definitions for utf8-buffer 1.0.0 // Project: https://github.com/rochars/byte-data // Definitions by: Rafael da Silva Rocha // Definitions: https://github.com/rochars/utf8-buffer /** * Read a string of UTF-8 characters from a byte buffer. * Invalid characters are replaced with 'REPLACEMENT CHARACTER' (U+FFFD). * @see https://encoding.spec.whatwg.org/#the-encoding * @see https://stackoverflow.com/a/34926911 * @param {!Uint8Array|!Array} buffer A byte buffer. * @param {number=} start The buffer index to start reading. * @param {?number=} end The buffer index to stop reading. * Assumes the buffer length if undefined. * @return {string} */ export function unpack( buffer: Uint8Array|number[], start: number, end?: number): string; /** * Write a string of UTF-8 characters to a byte buffer. * @see https://encoding.spec.whatwg.org/#utf-8-encoder * @param {string} str The string to pack. * @param {!Uint8Array|!Array} buffer The buffer to pack the string to. * @param {number=} index The buffer index to start writing. * @return {number} The next index to write in the buffer. */ export function pack( str: string, buffer: Uint8Array|number[], index?: number): number;