-
Notifications
You must be signed in to change notification settings - Fork 65
Description
I think it would be really cool if there where any possibility to hook into cloud storages somehow...
I'm thinking sftp, WebDAV, smb like access... We could define a hole new protocol from the ground up, maybe even based on CORS policy and http2?
Imagine being able to hook into Dropbox or Google Drive and not having to worry about how some complicated SDK of how they handle file/directory handles, permissions, and walking the file tree structure etc. or writing a own custom REST api for managing files or dealing with file locking
it would be super cool if we could define a web based protocol to communicate with cloud storages with the same set of permission request model with reading/writing/seeking in a "standard" way of doing things like move, delete and copy things. on the server without actually downloading the hole structure and re upload it
I'm pretty sure it could be possible to get File class that isn't represented by some memory data or a filesystem path to some physical place on your own harddrive.
There is already something analogous in the http2 implementation in the form of the respondWithFile() and respondWithFD() APIs in the http2 side. and browser already have some way to represent a File that don't yet have any data.
so maybe it could be possible to get a File object that yet haven't been downloaded?
getting a file with remoteHandle.getFile() would only get metadata of the file such as filename, size and type somehow without actually downloading the content of the file. only when you create some reader/writer would you actually perform some upload/download.
const directoryHandle = await navigator.storage.getRemoteDirectory('https://example.com/fsa/users/003/')
const directoryHandle = await navigator.storage.getRemoteDirectory('/fsa/users/003/')
const directoryHandle = await navigator.storage.getRemoteDirectory('https://webdav.icloud.com')
const directoryHandle = await navigator.storage.getRemoteDirectory('sftp://address:port/path')
const directoryHandle = await navigator.storage.getRemoteDirectory('smb://user:[email protected]/path')
// edit, another suggestion too:
const directoryHandle = await navigator.storage.getRemoteDirectory( await FileSystemHandle.getUniqueId() )Edit: after reading up on WebDAV a bit more it's essentually already a remote network drive covered by normal http request already and is pretty wildly used by quite many operation systems/application (one such thing is icloud's WebDAV)
i also just discovered that status code 207 is primarily defined for multistatus/webdav stuff and this xml based protocol is pretty annoying to work with, something newer and more modern would have been nicer to work with...