-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add execute() to FileSystemDirectoryHandle #97
Comments
Thank you for bringing this up! I think that executing code on the local file system belongs in a different specification, and should be an explicit non-goal of the native FS specification. |
@pwnall Thank you for your input. Technically native FS specification is already executing code on the local file system by reading and writing files on the local file system. The same underlying principal, specification details and implementation is involved with directly executing a file. |
To be absolutely clear the addition of |
Agreed that this is out of scope for this spec. |
This proposal is simple. Native File System can be granted permission to read and write to a local (or "sandboxed") directory and file.
Add
execute()
orexecuteScript()
method toFileSystemDirectoryHandle
.The basic algorithm
Context:
Window
,WorkerGlobalScope
,WorkletGlobalScope
let outputFileName = "file.ext", scriptName = "doStuff"
let nativeScripts = await self.requestNativeScripts(<Map> [[<${scriptName}>, "/path/to/local/directory/sciptName"]])
let writeScript = await nativeScripts.get(<${scriptName}>).write("#!/bin/bash ... doStuff(<${outputFileName}>)")
await writeScript.execute() // when outputFileName is written resolve Promise
let dir = await self.chooseFileSystemEntries({type: "openDirectory"})
let result = await dir.getFile(<${outputFileName}>) // get output of executed native application
The functionality is essentially possible now using
inotifywait
or similar directory and file change observation script or program. This proposed change to the specification incorporates that functionality into Native File System with the capability to set execute permission at a local file and execute that script file.WICG proposal [Proposal] requestNativeScripts() - Write, reference, execute native (shell) scripts in main thread, Worker, Worklet scope.
The text was updated successfully, but these errors were encountered: