ReplFiles! ~ Fetch ANY File from a Public Repl
h
RayhanADev

Hiya! It's Ray. Here's

ReplFiles!

Fetch ANY File from a Public Repl

Check out the API here
Quick Preview/Proof-of-Concept here

Storytime!

This is perhaps one of the more useful API's I've made for the Replit Community. I myself have always wanted to get files on a Repl, but (to my knowledge) there is no API endpoint or query to get files...

That's when @stungeye asked on the Feedback board for a tool to archive all Repls a Replit user has made. I set out to make such a tool and ended up with ArchiveIt. It fetches a .zip file available for every Repl at /@username/slug.zip, unzips the file to a folder, and then zips up the full folder of Repls.

It then dawned on me that I had access to EVERY file from those Repls. The NodeJS package Adm-Zip also makes accessing the content of all these files dirt simple. This trail led me to make this simple API that allows you to access any file, on any public Repl!

OKAY storytime over, here's how to use it :)

Usage

The API has two endpoints:

  • /file/{username}/{repl-slug}
  • and /files/{username}/{repl-slug}

The former is used for fetching a specific file. It returns an array with the file contents.
Example:
https://filesapi.replapiit.repl.co/file/RayhanADev/ArchiveIt?filename=src/index.js

You can also attach a raw=1 query to output the raw text without stringifying and nonsense.
Example:
https://filesapi.replapiit.repl.co/file/RayhanADev/ArchiveIt?filename=src/index.js&raw=1

--

The latter is used to get ALL files from a Repl. It returns an array with all files in a Repl. This uses a .gitignore file if present to filter out files.
Example:
https://filesapi.replapiit.repl.co/files/RayhanADev/ArchiveIt

and it's as simple as that! If you have any suggestions or ideas let me know in the comments below. Until next time :D.

P.S. ReplAPI.it integration with this API is on it's way >:)

You are viewing a single comment. View All
RayhanADev

@JBloves27 thanks uwu!