Recently, I'm trying to develop a PNaCl program that generates (or process) some files & informs the user to download them.
and achieved my purpose through following (simplified) steps:
- After request quota through navigator.webkitPersistentStorage.requestQuota (as original example),
record used filesystem (in variable filesystem) through window.webkitRequestFileSystem
(example.js) - Generate files through FileIO, FileRef, FileSystem as the original example
(file_io.cc) - Pass the full path of a specified file to JavaScript side with PostMessage
(file_io.cc) - With variable filesystem, get the file entry through passing the full path to filesystem.root.getFile method.
Use the file entry to translate the path to URL with fileEntry.toURL method.
In the end, paste the URL on index (through src or href)
(example.js)
The approach above, in my point of view, strongly depends on that the file system at both side (PNaCl & JavaScript)
are just the same (or kind of transformable), so I'm wondering:
- Is the approach I figure out a occasional solution? (with pepper 49 & google chrome 55)
- If it is, is there any other way to get the feature I need? (maybe... PPAPI will support translate path to URL in future revision?)
I will appreciate any of your replies; and please feel free asking me to provide more details if you need.
Best regards,
Arthur