Getting data into replpad-js

What are the best options for getting data into the replpad-js build (Ren Garden)?
Other than pasting data into the console, I am not clear on what other options exist and how to use them.
Thanks, John


For security reasons, READ of the clipboard without you initiating what the browser considers to be paste command isn't permitted. We don't necessarily have to say that always means "you see what you paste"...e.g. we could make it so if the focus is in a special place it would do something else (e.g. make a named resource for the paste content of some kind).

Note that you can WRITE to clipboard:// and that will work.


So far I've been using READ of URLs to get nontrivial data in. Anything that supports CORS will work.

If you have a way of publishing data on the web that supports CORS, that's an option. (Note we've made it work on GitHub and GitLab raw URLs.)

We Should Have an UPLOAD Command

There's a DOWNLOAD command for getting data from the Repl to a local file. But we should be have an UPLOAD command for sending local files (which I think requires putting up a dialog box?)

That shouldn't be hard. I'll look into it.

Filesystem Access API Needs Research

Beyond these options, there's something that is still in the standardization process called the Filesystem Access API

If someone were enthusiastic about learning how that worked and what the status of it was that would be great.

Look At the Local Storage Feature!

There is a "storage" file scheme which @rgchris made that lets you write files to locations that will persist between browser sessions at %/.

>> write %/persist.txt "This persists"

(refresh your browser)

>> as text! read %/persist.txt
== "This persists"

If you write files to %/tmp/ then it will be persisted for the current browser session, but won't be there afterward.

So if you are working with data that you UPLOAD or get from the clipboard this would save you from needing to do that multiple times. See documentation for issues like storage would be nice if we showed you some feedback on that (a little "storage used" bar somewhere in the UI?)

Drag And Drop => Temporary Storage?

I think if drag and drop of files into the Repl made that file available in the temporary storage that would be cool. If there was some UI--kind of like showing when you had attachments--where clicking on the attachment would insert a link you could read the data from that would be cool.

1 Like

Fantastic. That gives me plenty of options. Thanks, John