2013-05-30 18:57:33 +00:00
|
|
|
<!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"
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-05-31 01:38:44 +00:00
|
|
|
require(["src/file-system"], function(IDBFS) {
|
2013-05-30 18:57:33 +00:00
|
|
|
|
|
|
|
var flags = 'FORMAT';
|
2013-07-12 15:11:05 +00:00
|
|
|
//var flags;
|
2013-05-30 18:57:33 +00:00
|
|
|
|
2013-05-31 15:30:01 +00:00
|
|
|
var fs = new IDBFS.FileSystem('local', flags);
|
2013-07-22 17:08:35 +00:00
|
|
|
var buffer = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
|
|
|
|
console.log('buffer', buffer);
|
|
|
|
var data = new Uint8Array(buffer.length);
|
2013-07-22 18:31:44 +00:00
|
|
|
|
2013-07-22 17:08:35 +00:00
|
|
|
fs.open('/myfile', 'w+', function(error, fd) {
|
|
|
|
if(error) throw error;
|
|
|
|
console.log('descriptor:', fd);
|
2013-07-22 18:31:44 +00:00
|
|
|
fs.write(fd, buffer, 0, buffer.length, undefined, function(error, nbytes) {
|
2013-07-22 17:08:35 +00:00
|
|
|
console.log('write:', nbytes)
|
|
|
|
if(error) throw error;
|
2013-07-23 03:34:38 +00:00
|
|
|
fs.close(fd, function(error) {
|
|
|
|
if(error) throw error;
|
|
|
|
console.log('closed');
|
2013-07-26 02:49:53 +00:00
|
|
|
fs.link('/myfile', '/myotherfile', function(error) {
|
2013-07-22 18:31:44 +00:00
|
|
|
if(error) throw error;
|
2013-07-26 02:49:53 +00:00
|
|
|
console.log('linked');
|
2013-07-26 04:15:48 +00:00
|
|
|
fs.unlink('/myfile', function(error) {
|
2013-07-23 03:34:38 +00:00
|
|
|
if(error) throw error;
|
2013-07-26 04:15:48 +00:00
|
|
|
console.log('unlinked');
|
2013-07-23 03:34:38 +00:00
|
|
|
});
|
2013-07-22 18:31:44 +00:00
|
|
|
});
|
2013-07-22 17:08:35 +00:00
|
|
|
});
|
|
|
|
});
|
2013-07-12 15:11:05 +00:00
|
|
|
});
|
2013-05-30 18:57:33 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</html>
|