function fromString( str, encoding ) {
	if ( !isString( str ) ) {
		throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );
	}
	if ( arguments.length > 1 ) {
		if ( !isString( encoding ) ) {
			throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', encoding ) );
		}
		return Buffer.from( str, encoding );
	}
	return Buffer.from( str, 'utf8' );
}
Allocates a buffer containing a provided string.

@param {string} str - input string
@param {string} [encoding="utf8"] - character encoding
@throws {TypeError} first argument must be a string
@throws {TypeError} second argument must be a string
@throws {TypeError} second argument must be a valid encoding
@returns {Buffer} new `Buffer` instance

@example
var buf = fromString( 'beep boop' );
// returns <Buffer>