Coder Social home page Coder Social logo

glitchii / tempfile-site Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 4.0 1.75 MB

(Discontinued) A website that temporarily stores files to a chosen date and time

License: Mozilla Public License 2.0

JavaScript 15.25% EJS 69.29% CSS 15.46%
temporary-files temporary-data temporary file-storage javascript filesharing website expiry

tempfile-site's Introduction

(Discontinued) A website that temporarily stores files to a certain date or time.

Using Requests

Requests are done on the api path (/api/files/). After each request, a json response will be returned containing an 'ok' key (bool) to signify if it was successful or not. For example after a successful post request to upload a file, the output should look something like this:
{"ok":true,"link":"https://tempfile.site/files/filename.png"}

Getting a file

Use a get request to get a file eg.

curl -O http://tempfile.site/api/files/filename.png

If a file requires a password, send the password in a header with a pass key eg.

curl -O http://tempfile.site/api/files/filename.png -H "pass: the password"

Uploading a file

Use a post request to upload files with the file and the expiry date / time, eg.

curl -F datetime=1m -F file=@/path/to/file.png http://tempfile.site/api/files

For the expiry date, you can either use a timestamp string or a number with a unit eg. 3m for 3 minutes, 1w for a week, 1mo for 1 month or 2002-05-19T:08:00.000Z for my birthday (just make sure it's not in the past)

To use a custom filename, use a form argument with a name parameter (-F name=file-name). Filenames should not have special characters that aren't url friendly, in other words, it should follow this pattern [a-z0-9-_\.].

Other options:

limit: Download limit, don't add this for unlimited. (-F limit=5). After this limit, file will be deleted

pass: Password protect the file. (-F pass="A password")

ipblacklist: An IP to blacklist from downloading file. (-F ipblacklist="69.80.31.225"). For more than one IP, use a comma as separator instead of setting another form (-F), eg. -F ipblacklist="68.80.31.225,50.90.30.222"

ipwhitelist: If added, file will only be downloaded from this IP. And as mentioned above, you can seperate by a command if more than one.

authkey: Without this key, you won't be able to delete the file if it was not posted from the same IP. If you don't give a custom authkey parameter, it will be gerenerated for you and returned alongside the file link in response

All options must be lowercase.

Deleting a file

To delete a file you'll need to send a delete request to the file eg.

curl -X DELETE http://tempfile.site/api/files/filename.png

You can delete the file if it was uploaded from the same IP address, otherwise you will need an auth key. You can find the auth key by clicking 'more' from the options on the website before uploading.
To delete the file with the auth key you must send the key from a header named "authkey" eg.

curl -X DELETE http://tempfile.site/api/files/filename.png -H "authkey: the key"

tempfile-site's People

Contributors

dependabot[bot] avatar glitchii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tempfile-site's Issues

Can I list files?

Can I list files for same authorization keys using api? It would be very helpful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.