lib/rt-utils.js
function toBuffer(b) {
	// TODO: Use nodert-streams to more efficiently convert the buffer?
	let len = b.length;
	const DataReader = Windows.Storage.Streams.DataReader;
	let r = DataReader.fromBuffer(b);
	let a = new Uint8Array(len);
	for (let i = 0; i < len; i++) {
		a[i] = r.readByte();
	}
	return Buffer.from(a.buffer);
}
function toBuffer(b) {
	// TODO: Use nodert-streams to more efficiently convert the buffer?
	let len = b.length;
	const DataReader = Windows.Storage.Streams.DataReader;
	let r = DataReader.fromBuffer(b);
	let a = new Uint8Array(len);
	for (let i = 0; i < len; i++) {
		a[i] = r.readByte();
	}
	return Buffer.from(a.buffer);
}
function toBuffer ( b ) { // TODO: Use nodert-streams to more efficiently convert the buffer? let len = b . length ; const DataReader = Windows . Storage . Streams . DataReader ; let r = DataReader . fromBuffer ( b ) ; let a = new Uint8Array ( len ) ; for ( let i = 0 ; i < len ; i ++ ) { a [ i ] = r . readByte ( ) ; } return Buffer . from ( a . buffer ) ; }
Convert a WinRT IBuffer to a JS Buffer.
Convert a WinRT IBuffer to a JS Buffer .