filer/examples/refactoring-test.html

48 lines
874 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.fstat(fd, function(error, stats) {
if(error) throw error;
console.log('stats:', stats);
fs.close(fd, function(error) {
if(error) throw error;
console.log('closed');
});
});
});
} catch(e) {
console.error(e);
}
});
</script>
</html>