mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-29 05:54:21 +01:00
38 lines
903 B
HTML
38 lines
903 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<body>
|
|
<script type="module">
|
|
import { VFSInterface } from './src/opfs-interface.js';
|
|
|
|
console.log('made it here')
|
|
|
|
window.runTest = async () => {
|
|
console.log('made it here')
|
|
const vfs = new VFSInterface(new URL('./src/opfs-worker.js', import.meta.url).href);
|
|
console.log('made it here')
|
|
|
|
// Test file operations
|
|
const fd = await vfs.open('test.txt', {});
|
|
|
|
// Write data
|
|
const writeData = new Uint8Array([1, 2, 3, 4]);
|
|
const bytesWritten = await vfs.pwrite(fd, writeData, 0);
|
|
|
|
// Read data
|
|
const readData = new Uint8Array(4);
|
|
const bytesRead = await vfs.pread(fd, readData, 0);
|
|
|
|
// Close file
|
|
await vfs.close(fd);
|
|
|
|
return {
|
|
bytesWritten,
|
|
bytesRead,
|
|
readData: Array.from(readData)
|
|
};
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|