of File System API to read a text file on my mobile and I tried this:
<script type="text/javascript" language="javascript">
async function getTheFile() {
const directoryHandle = FileSystemDirectoryHandle;
const dirName = "/tmp";
const handle = await directoryHandle.getDirectoryHandle(dirName);
const fileName = "mylog";
const fileHandle = await handle.getFileHandle(fileName);
if (!fileHandle) {
return "unknown";
}
const fileData = fileHandle.getFile();
return fileData;
}
getTheFile().then(content => document.getElementById("contentfile").value = content);
</script>
but I get this kind of error :
Uncaught (in promise) TypeError: directoryHandle.getDirectoryHandle is not a function
maybe I have to load someway those File System API?... thanks in advance for any direction....
https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Обсуждают сегодня