{"id":15684248,"url":"https://github.com/nwtgck/trans-server-akka","last_synced_at":"2025-05-07T15:51:12.251Z","repository":{"id":52453042,"uuid":"102300511","full_name":"nwtgck/trans-server-akka","owner":"nwtgck","description":"A Server for Transmitting File by curl or wget: Transfer data over HTTP/HTTPS","archived":false,"fork":false,"pushed_at":"2021-04-28T21:40:42.000Z","size":1536,"stargazers_count":10,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2023-02-27T02:56:57.917Z","etag":null,"topics":["akka-http","docker","filetransfer","http","scala","transfer"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nwtgck.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-03T23:28:41.000Z","updated_at":"2022-02-19T13:03:11.000Z","dependencies_parsed_at":"2022-09-08T09:30:34.567Z","dependency_job_id":null,"html_url":"https://github.com/nwtgck/trans-server-akka","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Ftrans-server-akka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Ftrans-server-akka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Ftrans-server-akka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Ftrans-server-akka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nwtgck","download_url":"https://codeload.github.com/nwtgck/trans-server-akka/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219870506,"owners_count":16555151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["akka-http","docker","filetransfer","http","scala","transfer"],"created_at":"2024-10-03T17:13:27.610Z","updated_at":"2024-10-03T17:13:28.247Z","avatar_url":"https://github.com/nwtgck.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trans-server\n\nTransmit files by using **only common Unix/Linux commands, `curl` or `wget`**\n\n| branch | TravisCI | CircleCI | Coverage |\n| --- | --- | --- | --- |\n| [`master`](https://github.com/nwtgck/trans-server-akka/tree/master) | [![Build Status](https://travis-ci.org/nwtgck/trans-server-akka.svg?branch=master)](https://travis-ci.org/nwtgck/trans-server-akka) | [![CircleCI](https://circleci.com/gh/nwtgck/trans-server-akka/tree/master.svg?style=shield)](https://circleci.com/gh/nwtgck/trans-server-akka/tree/master) | [![Coverage Status](https://coveralls.io/repos/github/nwtgck/trans-server-akka/badge.svg?branch=master)](https://coveralls.io/github/nwtgck/trans-server-akka?branch=master) |\n| [`develop`](https://github.com/nwtgck/trans-server-akka/tree/develop) | [![Build Status](https://travis-ci.org/nwtgck/trans-server-akka.svg?branch=develop)](https://travis-ci.org/nwtgck/trans-server-akka) | [![CircleCI](https://circleci.com/gh/nwtgck/trans-server-akka/tree/develop.svg?style=shield)](https://circleci.com/gh/nwtgck/trans-server-akka/tree/develop) | [![Coverage Status](https://coveralls.io/repos/github/nwtgck/trans-server-akka/badge.svg?branch=develop)](https://coveralls.io/github/nwtgck/trans-server-akka?branch=develop) |\n\n## Send a file by wget\n\n![wget_send](demos/wget_send.gif)\n\n## Download the file by wget\n\n![wget_get](demos/wget_get.gif)\n\n## Public Server on Heroku\n\nhttps://trans-akka.herokuapp.com/\n\n\n## Quick Start\n\nYou can send, download and delete a file by the following commands.\n\n```\n# Send a file\nwget -q -O - https://trans-akka.herokuapp.com/ --post-file=./test.txt\n```\n\n```\n# Downlaod the file\nwget https://trans-akka.herokuapp.com/a7h\n# ('a7h' is a File ID created after sending)\n```\n\n```\n# Delete a file\nwget -q -O - --method DELETE https://trans-akka.herokuapp.com/a7h\n```\n\n\n### Option explanations\n\n* `-q`: No prgress bar\n* `-O -`: Response to stdout\n\n\n## Main features\n\n* Send/Get by **only common commands**, `curl` or `wget`\n* Send/Get **on your browser**\n* Send/Get with restrictions\n  - download key\n  - store duration\n  - how many times you can download\n* Delete files you sent\n  - without delete key\n  - with delete key\n* Change File ID length (for security)\n* Encrypt and Compress file for security\n\n## How to run the server\n\nYou can choose any ways you want bellow.\n\n### Way 1 - Run on Docker\n\n[![Docker Automated build](https://img.shields.io/docker/automated/nwtgck/trans-server-akka.svg)](https://hub.docker.com/r/nwtgck/trans-server-akka/)\n\n```bash\ndocker run -p 8080:8181 nwtgck/trans-server-akka\n```\n\nThen you can go http://localhost:8080/\n\n#### Docker run for daemonize and data persistence\n\nYou can also run the following command for **daemonize** and **data persistence**.\n\n```bash\ndocker run -d -p 8080:8181 -v $PWD/trans-db:/trans/db --restart=always nwtgck/trans-server-akka\n```\n\nData will be stored in `$PWD/trans-db` on your host machine. (Currently file-base H2 database is used, and files sent are stored as compressed and encrypted files)\n\n### Way 2 - sbt \"run-main ...\"\n\nThe following example runs a server on 80 port.\n```sh\n$ cd \u003cthis-project\u003e\n$ ./make-keystore.sh\n$ sbt \"run-main io.github.nwtgck.trans_server.Main --http-port=8282\"\n```\n\n### Way 3 - Making a jar\n\n#### 1. Make a keystore\n\n```sh\n$ cd \u003cthis-project\u003e\n$ ./make-keystore.sh\n```\n\n\n#### 2. Make a jar\n\n```sh\n$ cd \u003cthis-project\u003e\n$ sbt assembly\n```\n(It takes a time)\n\n#### 3. Run the jar\n\n```sh\n$ java -jar target/scala-2.11/trans-server-akka.jar --http-port=8282 --https-port=4433\n```\n\n## How to send a file to the server\n\n### Way 1 - curl\n\nThe following example is sending `../test.txt`\n\n```\n$ curl https://trans-akka.herokuapp.com/ --data-binary @../test.txt\n```\n\n#### output\n```\nab2\n```\n\nThe server response, `ab2` is a File ID to get `../test.txt`\n\n\n### Way 2 - wget\n\nThe following example sends `../test.txt`\n\n```sh\n$ wget -q -O - https://trans-akka.herokuapp.com/ --post-file=../test.txt\n```\n\n* `-q` is for non-progress bar\n* `-O -` is to output STDOUT  \n\n#### output\n```\n9vi\n```\n\nThe server response, `9vi` is a File ID to get `../test.txt`\n\n\n### Way 3 - wc \u0026 cat \u0026 nc\n\n**This way is for a user which can't use `curl` command.**\n\nThe following example sends `sounds.zip`.\n\n#### 1. Get a file byte\n\n```sh\n$ wc -c  \u003c sounds.zip\n```\n\n\n##### output\n```\n1161257298 # Use it later\n```\n\n#### 2. Create `header.txt`\n\n```\nPOST / HTTP/1.1\nHost: localhost:4343\nContent-Length: 1161257298\n\n```\n\nDon't forget the end of `'\\n'`\n\n #### 3. Send a file by HTTP request\n\n\n```\n$ cat header.txt sounds.zip | nc localhost 4343\n```\n\n\n The response is bellow.\n```\nHTTP/1.1 200 OK\nServer: akka-http/10.0.5\nDate: Sun, 23 Apr 2017 04:22:32 GMT\nConnection: close\nContent-Type: text/plain; charset=UTF-8\nContent-Length: 4\n\n6oz\n```\n\n`6oz` is FILE ID.\n\n\n## How to get a file from the server\n\n### Way 1 - wget\n\n```sh\n$ wget https://trans-akka.herokuapp.com/ab2\n```\n\n`ab2` is a File ID.\n\n### Way 2 - curl\n\n\n```sh\n$ curl https://trans-akka.herokuapp.com/ab2 \u003e test.txt\n```\n\n`ab2` is a File ID.\n\n\n### Way 3 - Using a Browser\n\nOpen `https://trans-akka.herokuapp.com/ab2` on your browser\n\n`ab2` is a File ID.\n\n\n## Sending-options\n\nHere is options you can use when sending\n\n|GET parameter | default value | decription |\n|---|---:|---|\n| `duration`    | 1 hour        | Store duration/life                                  |\n| `get-times`   | infinite      | How many times you can download                      |\n| `id-length`   | `3`           | Length of File ID                                    |\n| `deletable`   | `true`        | Whether a file can be deleted                        |\n| `delete-key`  | nothing       | Key for deletion                                     | \n| `secure-char` | `false`       | Whether more complex characters are used for File ID | \n\n### An example with options\n\n```bash\nwget -q -O - 'https://trans-akka.herokuapp.com/?duration=30s\u0026get-times=1\u0026id-length=16\u0026delete-key=mykey1234\u0026secure-char' --post-file=./hello.txt\n```\n\nThe command means\n* duration is 30 seconds\n* download once\n* File ID length is 16\n* The file is deletable and key is `'mykey1234'`\n* Use more complex characters for File ID\n\n### Available duration examples\n* `10s` - 10 seconds\n* `2m`  - 2 minutes\n* `12h` - 12 hours\n* `25d` - 25 days\n\n### Usage of `deletable`\n\nAll bellow are valid usages.\n\n```bash\n'https://trans-akka.herokuapp.com/?deletable'\n# (same meaning as `deletable=true`)\n```\n\n```bash\n'https://trans-akka.herokuapp.com/?deletable=true'\n```\n\n```bash\n'https://trans-akka.herokuapp.com/?deletable=false'\n```\n\n### Set download key\n\n```bash\ncurl -u dummy_user:mypass123 -T ./hello.txt  https://trans-akka.herokuapp.com\n```\n\nWhen you don't want to type key in command, you can use `-u dummy_user` instead of `-u dummy_user:mypass123`. Then, `curl` provide you a password prompt.\n\nNOTE: `dummy_user` can be change any name including empty `''`.\n\n\n### Get with download key\n\n```bash\ncurl -u dummy_user:mypass123 https://trans-akka.herokuapp.com/yk2\n```\n\nNOTE: The server doesn't check user name. So, you can use any name for user name, not only `\"dummy_user\"`.\n\n\n## Delete file\n\n## delete without delete key\n\n```bash\n# wget version\nwget -q -O - --method=DELETE 'https://trans-akka.herokuapp.com/vua'\n```\n\n```bash\n# curl version\ncurl -X DELETE 'https://trans-akka.herokuapp.com/vua'\n```\n(`vua` is a File ID)\n\n## delete with delete key\n\n```bash\n# wget version\nwget -q -O - --method=DELETE 'https://trans-akka.herokuapp.com/6em?delete-key=1234'\n```\n\n```bash\n# curl version\ncurl -X DELETE 'https://trans-akka.herokuapp.com/6em?delete-key=1234'\n```\n\n## My Note\n\n[MYNOTE.md](MYNOTE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwtgck%2Ftrans-server-akka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnwtgck%2Ftrans-server-akka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwtgck%2Ftrans-server-akka/lists"}