{"id":19732346,"url":"https://github.com/terminusdb/tus","last_synced_at":"2026-03-07T14:03:47.933Z","repository":{"id":40408935,"uuid":"320542358","full_name":"terminusdb/tus","owner":"terminusdb","description":"TUS protocol for resumable file uploads via HTTP","archived":false,"fork":false,"pushed_at":"2026-02-15T22:02:56.000Z","size":80,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-02-16T05:44:52.131Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Prolog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terminusdb.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-12-11T10:32:57.000Z","updated_at":"2026-02-15T22:03:00.000Z","dependencies_parsed_at":"2024-11-05T09:23:15.990Z","dependency_job_id":"64a89260-18ad-4fea-845c-eeefafd673ac","html_url":"https://github.com/terminusdb/tus","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/terminusdb/tus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminusdb%2Ftus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminusdb%2Ftus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminusdb%2Ftus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminusdb%2Ftus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terminusdb","download_url":"https://codeload.github.com/terminusdb/tus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminusdb%2Ftus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30216513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T14:02:48.375Z","status":"ssl_error","status_checked_at":"2026-03-07T14:02:43.192Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-12T00:25:55.865Z","updated_at":"2026-03-07T14:03:42.924Z","avatar_url":"https://github.com/terminusdb.png","language":"Prolog","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# TUS in swipl\n\nTUS protocol for resumable file uploads via HTTP in swipl (see:\n[TUS](https://tus.io/))\n\nThis package implements both the server handlers and a simple client.\n\nThe package implements the core protocol along with four extensions:\n\n* Creation\n* Expiration\n* Checksum\n* Termination\n\n# Options\n\nOptions for the server can be set with the `set_tus_options/1`\npredicate which has the following options:\n\n* `tus_storage_path(Path)`: The `Path` contains the location of the\nstorage folder to be used for uploads. If not set it will default to a\ntemporary directory.\n* `tus_max_size(Size)`: The `Size` is the maximum allowable upload\nsize in bytes. Defaults to `17_179_869_184` bytes.\n* `tus_client_chunk_size(Size)`: The `Size` is the size of chunks to\n  be uploaded. The default is `16_777_216` bytes.\n* `tus_expiry_seconds(Seconds)`: The `Seconds` is the total number of\n  seconds before the resource expires. This will allow resources which\n  are not fully uploaded to be removed.\n\nFor instance, to set a larger client chunk size one can call:\n\n```prolog\n:- set_tus_options([tus_client_chunk_size(33_554_432)]).\n```\n\n## Examples\n\n### Server\n\nTo use the TUS server with the HTTP library in swipl you can simply\nadd a `tus_dispatch` call to your http_handler from a chosen endpoint\nas follows:\n\n```prolog\n:- http_handler(root(files), tus_dispatch,\n                [ methods([options,head,post,patch,delete]),\n                  prefix\n                ]).\n```\n\nIn order to determine the location of a given resource when passed the\nresource URL in other contexts you can use the utility predicate\n`tus_uri_resource(URI, Resource)` together with\n`tus_resource_path(Resource, Resource_Path)`. In this way once a\nclient has uploaded a resource it can be referred to in client-server\ncommunications, and be moved, modified or manipulated by server code.\n\n### Domains and Authorization in Server\n\nThe server does not manage authorization, but it is possible to use\nauthorization to provide isolation of user data by providing the\n`tus_dispatch/2` predicate with options which include\n`[domain(Domain)]`.\n\nYou can use any authorization system you'd like (basic, JWT etc.) to\nguard access to this domain token and the domain token will be used to\nensure isolation.\n\nThe following code shows how you might add a handler which carries\nwith it a domain after authorization. There is a more complete example\nin the tests in [prolog/tus.pl](prolog/tus.pl).\n\n```prolog\n:- meta_predicate auth_wrapper(2,?).\nauth_wrapper(Goal,Request) :-\n    authorize(Request, Domain),\n    call(Goal, [domain(Domain)], Request).\n\nspawn_auth_server(URL, Port) :-\n    random_between(49152, 65535, Port),\n    http_server(http_dispatch, [port(Port), workers(1)]),\n    http_handler(root(files), auth_wrapper(tus_dispatch),\n                 [ methods([options,head,post,patch,delete]),\n                   prefix\n                 ]),\n    format(atom(URL), 'http://127.0.0.1:~d/files', [Port]).\n```\n\n### Client\n\nThe client invocation requires only the endpoint of interest and a\nfile and can be invoked thus:\n\n```prolog\ntus_upload(Example, URL, Resource)\n```\n\nThe `Resource` variable gives back a resource handle that the server can use to\nrefer to the resource in subsequent communication.\n\n## TODO\n\nThe remaining extensions would be desirable:\n\n* Creation with Upload\n* Concatenation\n\nIn addition the Creation extension should be checked from the Options\ncall before initiating an upload.\n\n## Copyright\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you\nmay not use this file except in compliance with the License. You may\nobtain a copy of the License at\n\n```\nhttp://www.apache.org/licenses/LICENSE-2.0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterminusdb%2Ftus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterminusdb%2Ftus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterminusdb%2Ftus/lists"}