ZIP Editor Extension

Describe your Extension idea

This extension allows you to open ZIPS, extract them, and also make them!

What problem(s) would this Extension solve?

This extension solves the fact when you click on a zip file in the replit IDE, it shows up as weird glitchy text.

Explain what you were trying to do when you came across the problem leading to this Extensions request

I came across this problem a little bit ago when I tried to open a ZIP in replit

5 Likes

You can already most definitely do this in replit without an extension, but a visual would be nice, although this would be impossible without a backend for the extension.

2 Likes

I would be interested in making this! There are some client side JS libraries that allow you to parse zip files

3 Likes

@OtterDev

This extension solves the fact when you click on a zip file in the replit IDE, it shows up as weird glitchy text.

That’s the literal low-level bytes being displayed instead of being converted into folders, files, etc.

3 Likes

For a backend, couldn’t you just have a service inside the repl that watches for changes to a file and adds its output to another file for the extension to see, so then some kind of API could be used?

2 Likes

yes, that is what i meant.

2 Likes

The extension could just install unzip via Nix and then uncompress in /tmp (temporary files) to not take up the Repl’s storage. No need for JS libraries.

1 Like

Extensions can’t install nix libraries or run commands right now AFAIK. That would be a much better solution when we get those capabilities

You could of course make a custom backend for the extension which unzips it on the server side though

3 Likes

Decompressing client-side would require the client to download the .zip and upload the uncompressed files…

2 Likes

The thing is, extensions only run client side right now. Replit provides client side APIs that allow them to read/write files and directories directly, so using a client side JS API is probably simplest IMO

The thing is, with egress limits, downloading a 200mb+ file and re-uploading each file in it wouldn’t work well

The only solution that doesn’t involve downloading it and reuploading the extracted files would be one that directly interfaces with the Repl’s command line and runs entirely on the repl. Hopefully we will see this capability for extensions in the near future…

I’m not saying a client side extraction library is efficient or anything - it’s just the simplest solution we have right now.

There is no official way to run commands on a Repl. But it’s possible. It’s just very very very slow. But you can write to the Repl’s bashrc file located in .config/bashrc and then it will (eventually) get run. Haven’t tested it though.

1 Like

Can you open a shell tab using the API and download a static binary using the bashrc that communicates with the extension?

1 Like

Probably. Write to the bashrc and make it install a back door for running commands in the future and then use the layout pane to open and close a shell, which will run the bashrc. Genius

2 Likes

I’ll probably make a lib for this until they officially release running commands on the Repl.

2 Likes

Well here it is for anyone that wants to use it: https://replit-extension-shell-commands-lib.luisafk.repl.co

To use it, load the lib.js file in your extension, and then use replit.runShellCommand() to run a command.

Please note that this is a temporary solution until running shell commands is available officially.