{"id":15646485,"url":"https://github.com/martinheidegger/quickhost","last_synced_at":"2025-03-29T23:17:22.880Z","repository":{"id":145299888,"uuid":"267235448","full_name":"martinheidegger/quickhost","owner":"martinheidegger","description":"Hosts html files temporarily based on a max amount of size in a LRU cache. Allows upload using secret keys.","archived":false,"fork":false,"pushed_at":"2020-06-02T05:20:34.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T00:41:57.585Z","etag":null,"topics":["browserstack","server","test"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/martinheidegger.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-27T06:09:32.000Z","updated_at":"2020-06-02T05:20:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"76d7831f-36fc-4597-8103-7fb28306dc0b","html_url":"https://github.com/martinheidegger/quickhost","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Fquickhost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Fquickhost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Fquickhost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Fquickhost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinheidegger","download_url":"https://codeload.github.com/martinheidegger/quickhost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246254149,"owners_count":20747949,"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":["browserstack","server","test"],"created_at":"2024-10-03T12:13:02.673Z","updated_at":"2025-03-29T23:17:22.864Z","avatar_url":"https://github.com/martinheidegger.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quickhost\n\nServer and upload-client to quickly host a single static html page - useful for [browserstack](https://browserstack.com) test.\n\n## Motivation\n\nTo test JavaScript code running in a browser, browserStack offers a good test platform but the selenium tests require the html\nfiles to be available in the internet. The problem is if you have files locally: how can you make them accessible by browserstack?\n\nThis is a simple http hosting server that - using a secret - allows to upload any given html file and hosts it for a limited amount\nof time. It also has a limit on amount of files to be hosted which means it cleans up after itself.\n\n## Start a server\n\nPrerequisites: Node running!\n\n```sh\n$ env \\\n    QUICKHOST_SECRET=$(node -p \"crypto.randomBytes(8).toString('hex')\") \\\n    QUICKHOST_MAX=10 # (optional) Max number of html files to be hosted - default 10 \\\n    QUICKHOST_MAX_SIZE=3145728 # (optional) Max number of bytes of a file to be hosted - default 3 Megabytes \\\n    PORT=1234 # (optional) Port where the server will connect to - default 1234 \\\n    HOST=localhost # (optional) Host where the server will connect to - default 0 \\\n    npx quickhost\n```\n\n**Important note:** You should run nginx and letsencrypt to have turn the [server into an https server](https://www.codementor.io/@marcoscasagrande/installing-express-nginx-app-on-ubuntu-18-04-with-ssl-using-certbot-pdt44g5gs).\n\n## Upload\n\nOnce the server is running you can upload and download files from that server using a simple API:\n\n1. `npm install @leichtgewicht/quickhost`\n2. \n    ```javascript\n    const upload = require('quickhost')\n    const download = require('node-fetch')\n    const server = 'https://quickhost.my-host.com'\n\n    const key = await upload({\n      server, // Server url where the quickhost server is running\n      secret: 'secret-from-server', // Secret used when starting the quickhost server\n      data: '\u003chtml\u003e\u003cb\u003eHello World\u003c/b\u003e\u003c/html\u003e', // Data to be uploaded to the quickhost server\n      timeout: 5000 // Timeout for the upload\n    })\n\n    const data = await fetch(`${server}/${key}`) // Now we can download the server\n    ```\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinheidegger%2Fquickhost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinheidegger%2Fquickhost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinheidegger%2Fquickhost/lists"}