On 2/3/22 8:37 PM, Nigel Tao wrote:
On Thu, Jan 27, 2022 at 3:23 AM Brianna Goldstein
<brgoldst...@chromium.org> wrote:
On Thu, Jan 27, 2022 at 2:49 AM Yoav Weiss <yoavwe...@chromium.org> wrote:
At the risk of piling on with another question: are these URLs different from
`file://` scheme URLs?
@Yoav Weiss yes these are from the `filesystem://` scheme which is different
from `file://`. Here's some information about where this scheme comes from.
I'll ask another naive question...
I understand "file://" URLs. "file:///home/user/bar.txt" is an example.
Can you give some examples of "filesystem://" URLs? Do they look like
"filesystem:///home/user/bar.txt" or
"filesystem://example.domain/foo/bar.txt" or something else? Do these
URLs look different for Android versus Desktop? Do they look different
for Browser App versus Web View?
Here's some sample code to illustrate how to get a filesystem URL:
https://gist.github.com/miketaylr/df58ae669abc4eec1b514f4cfc71fc21 -
pasted below as well
```
function writeFile(fs) {
fs.root.getFile("coolguy.txt", {create: true}, fileEntry => {
fileEntry.createWriter(fileWriter => {
fileWriter.onwriteend = e => {
window.webkitRequestFileSystem(window.TEMPORARY, 1024, readFile);
};
fileWriter.write(new Blob(["😎😎😎"], {type: "text/plain"}));
});
});
}
function readFile(fs) {
fs.root.getFile("coolguy.txt", {}, fileEntry => {
fileEntry.file(file => {
const reader = new FileReader();
reader.onloadend = e => {
console.log(e, fileEntry.toURL());
};
reader.readAsText(file);
});
});
}
navigator.webkitTemporaryStorage.requestQuota(1024, granted => {
window.webkitRequestFileSystem(window.TEMPORARY, granted, writeFile);
});
```
--
You received this message because you are subscribed to the Google Groups
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to blink-dev+unsubscr...@chromium.org.
To view this discussion on the web visit
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/35b0b3cc-26bd-b44e-8e1e-0e05d7ac11dd%40chromium.org.