fs
fs copied to clipboard
AccessHandles need a better name
(Migrated from https://github.com/WICG/file-system-access/issues/371.)
Currently, a FileSystemFileHandle gives you a FileSystem(Sync)AccessHandle by calling FileSystemFileHandle. create(Sync)AccessHandle(). This means you end up with code like below:
// Before:
const accessHandle = await fileHandle.createSyncAccessHandle();
accessHandle.write(…)
I wonder if maybe we do something else instead: similar to FileSystemFileHandle.getFile(), we could just have FileSystemFileHandle.get(Sync)HighPerformanceFile() or something, which then exposes all the things as listed in the IDL.
// After:
const hiPerfFile = await fileHandle.getSyncHighPerformanceFile();
hiPerfFile.write(…);
This would mean you get a special kind of high performance file object rather than a handle on a handle. It wouldn't be symmetric to File objects, but conceptionally it feels at least a little cleaner to me.
In addition - we simply need a more descriptive and easily disambiguated name for the API than "File System Access Handles API".
- We already have a File System Access API, which allows some access to a user's filesystem.
- There's a File and Directory Entries API.
- There's also the venerable File interface.
I fear that developers will have a hard time discovering the File System Access Handles API as it's currently named, and people will struggle to differentiate it from File System Access.
What's special about the new API is that it allows low-level access to files with a POSIX-like interface. Developers can build all sorts of things on top, including database implementations.
@a-sully, Ayu, @tomayac and I have been throwing around ideas with others, but nothing seems quite right. Something about fundamentals? File basics? Buffers or streams seem tempting, but we're not always dealing with actual buffers or streams.
...have been throwing around ideas with others, but nothing seems quite right. Something about fundamentals? File basics?
Here are some other contextually-relevant synonyms:
- base
- core
- essential
e.g. CoreFile(Handle)
Buffers or streams seem tempting, but we're not always dealing with actual buffers or streams.
But it is always binary data, right? The linked IDL lists properties and methods that deal with byte-oriented data.
e.g. FileBytes(Handle)
Thanks for the ideas! "Core" draws me in. As does "bytes". Because this API allows you to deal with bytes directly.
People once batted around the phrase "Native I/O" here, and a couple of people have mentioned that "I/O" seems to also evoke the basic functionality of reading and writing bytes.