lib/archivist/vaults/couchbase/defaultTopicApi.js
function flagsToStr(flags) {
	if (!flags) {
		return;
	}

	var buff = new Buffer(4);
	buff.writeUInt32BE(flags, 0);

	// return a 0-byte terminated or 4-byte string

	switch (0) {
	case buff[0]:
		return;
	case buff[1]:
		return buff.toString('utf8', 0, 1);
	case buff[2]:
		return buff.toString('utf8', 0, 2);
	case buff[3]:
		return buff.toString('utf8', 0, 3);
	default:
		return buff.toString();
	}
}
function flagsToStr(flags) {
	if (!flags) {
		return;
	}

	var buff = new Buffer(4);
	buff.writeUInt32BE(flags, 0);

	// return a 0-byte terminated or 4-byte string

	switch (0) {
	case buff[0]:
		return;
	case buff[1]:
		return buff.toString('utf8', 0, 1);
	case buff[2]:
		return buff.toString('utf8', 0, 2);
	case buff[3]:
		return buff.toString('utf8', 0, 3);
	default:
		return buff.toString();
	}
}
function flagsToStr ( flags ) { if ( ! flags ) { return ; } var buff = new Buffer ( 4 ) ; buff . writeUInt32BE ( flags , 0 ) ; // return a 0-byte terminated or 4-byte string switch ( 0 ) { case buff [ 0 ] : return ; case buff [ 1 ] : return buff . toString ( 'utf8' , 0 , 1 ) ; case buff [ 2 ] : return buff . toString ( 'utf8' , 0 , 2 ) ; case buff [ 3 ] : return buff . toString ( 'utf8' , 0 , 3 ) ; default : return buff . toString ( ) ; } }
Turns uint32 into a max 4 char string.
The node.js Buffer class provides a good uint32 conversion algorithm that we want to use.

@param {number} flags
@returns {string}
Turns uint32 into a max 4 char string . The node . js Buffer class provides a good uint32 conversion algorithm that we want to use .