Skip to content

Add execute() to FileSystemDirectoryHandle #97

Closed
@guest271314

Description

@guest271314

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

  1. let outputFileName = "file.ext", scriptName = "doStuff"
  2. let nativeScripts = await self.requestNativeScripts(<Map> [[<${scriptName}>, "/path/to/local/directory/sciptName"]])
  3. let writeScript = await nativeScripts.get(<${scriptName}>).write("#!/bin/bash ... doStuff(<${outputFileName}>)")
  4. await writeScript.execute() // when outputFileName is written resolve Promise
  5. let dir = await self.chooseFileSystemEntries({type: "openDirectory"})
  6. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions