filer/examples/buffer-test.html

45 lines
967 B
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="stdout"></div>
</body>
<script src="../lib/require.js"></script>
<script>
require.config({
baseUrl: "../lib",
paths: {
"src": "../src"
}
});
require(["src/buffer"], function(Buffer) {
try {
/*
var string1 = "\u00BD + \u00BC";
var string2 = " = \u00BE";
var buffer1 = new Buffer(string1);
var buffer2 = new Buffer(string2);
console.log(buffer1.toString(), ";", buffer2.toString());
var buffer3 = Buffer.concat([buffer1, buffer2]);
console.log(buffer3.toString());
var buffer4 = buffer3.slice(0, 7);
console.log(buffer4.toString());
*/
var buffer = new Buffer(4);
buffer.writeUInt32LE(0xDEADBEEF, 0);
console.log(0xDEADBEEF | 0x0);
console.log(buffer.readUInt32LE(0));
buffer.writeUInt32BE(0xDEADBEEF, 0);
console.log(buffer.readUInt32BE(0));
// console.log(buffer.readUInt16LE(0));
} catch(e) {
console.log(e);
}
});
</script>
</html>