/** * From Emscripten project */ /** * Returns the number of bytes the given Javascript string takes if encoded as a * UTF8 byte array, EXCLUDING the null terminator byte. * * @param {string} str - JavaScript string to operator on * @return {number} Length, in bytes, of the UTF8 encoded string. */ export declare function lengthBytesUTF8(str: string): number; /** * Copies the given Javascript String object 'str' to the given byte array at * address 'outIdx', encoded in UTF8 form and null-terminated. The copy will * require at most str.length*4+1 bytes of space in the HEAP. Use the function * lengthBytesUTF8 to compute the exact number of bytes (excluding null * terminator) that this function will write. * * @param {string} str - The Javascript string to copy. * @param {ArrayBufferView|Array} heap - The array to copy to. Each * index in this array is assumed * to be one 8-byte element. * @param {number} outIdx - The starting offset in the array to begin the copying. * @param {number} maxBytesToWrite - The maximum number of bytes this function * can write to the array. This count should * include the null terminator, i.e. if * maxBytesToWrite=1, only the null terminator * will be written and nothing else. * maxBytesToWrite=0 does not write any bytes * to the output, not even the null * terminator. * @return {number} The number of bytes written, EXCLUDING the null terminator. */ export declare function stringToUTF8(str: string, heap: Uint8Array, outIdx: number, maxBytesToWrite: number): number;