filer/examples/refactoring-test.html

48 lines
878 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/file-system"], function(IDBFS) {
var flags = 'FORMAT';
//var flags;
var fs = new IDBFS.FileSystem('local', flags);
var buffer = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
console.log('buffer', buffer);
var data = new Uint8Array(buffer.length);
try {
fs.open('/tmp', 'w+', function(error, fd) {
if(error) throw error;
console.log('descriptor:', fd);
fs.lseek(fd, 2, 'END', function(error, pos) {
if(error) throw error;
console.log('pos:', pos);
fs.close(fd, function(error) {
if(error) throw error;
console.log('closed');
});
});
});
} catch(e) {
console.error(e);
}
});
</script>
</html>