Tensorflow.js tf.encodeString() Function
Tensorflow.js is an open-source library which is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment.
The .encodeString() function is used to encode the stated string into bytes with the help of the given encoding scheme.
- s: It is the stated string which is to be encoded. It is of type string.
- encoding: It is the encoding scheme which is to be used. And the by default value is utf-8.
Return Value: It returns Uint8Array.
Example 1: When encoding scheme is not provided.
Example 2: When encoding scheme is provided.