encoder.js
function bufferFromFile( filename ) {
	console.info( ("Loading "+filename).grey );
	var buf = fs.readFileSync( filename ),	// Load Buffer
    	ab = new ArrayBuffer( buf.length ),	// Create an ArrayBuffer to fit the data
    	view = new Uint8Array(ab);			// Create an Uint8Array view

    // Copy buffer into view
    for (var i = 0; i < buf.length; ++i)
        view[i] = buf[i];

    // Return buffer view
    return view;
}
function bufferFromFile( filename ) {
	console.info( ("Loading "+filename).grey );
	var buf = fs.readFileSync( filename ),	// Load Buffer
    	ab = new ArrayBuffer( buf.length ),	// Create an ArrayBuffer to fit the data
    	view = new Uint8Array(ab);			// Create an Uint8Array view

    // Copy buffer into view
    for (var i = 0; i < buf.length; ++i)
        view[i] = buf[i];

    // Return buffer view
    return view;
}
function bufferFromFile ( filename ) { console . info ( ( "Loading " + filename ) . grey ) ; var buf = fs . readFileSync ( filename ) , // Load Buffer ab = new ArrayBuffer ( buf . length ) , // Create an ArrayBuffer to fit the data view = new Uint8Array ( ab ) ; // Create an Uint8Array view // Copy buffer into view for ( var i = 0 ; i < buf . length ; ++ i ) view [ i ] = buf [ i ] ; // Return buffer view return view ; }
Load a Uint8Array buffer from file
Load a Uint8Array buffer from file