Closed
Description
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()
or executeScript()
method to FileSystemDirectoryHandle
.
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.