{"id":22148544,"url":"https://github.com/hongquan/duri","last_synced_at":"2025-07-26T02:32:35.692Z","repository":{"id":57622388,"uuid":"393943194","full_name":"hongquan/Duri","owner":"hongquan","description":"CLI tool to get data URI of a file","archived":false,"fork":false,"pushed_at":"2023-08-19T03:44:11.000Z","size":34,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-26T01:33:33.058Z","etag":null,"topics":["api-client","base64","cli","data-uri","image","made-in-vietnam"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hongquan.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}},"created_at":"2021-08-08T11:37:29.000Z","updated_at":"2024-06-25T17:22:59.000Z","dependencies_parsed_at":"2022-09-26T20:10:43.422Z","dependency_job_id":null,"html_url":"https://github.com/hongquan/Duri","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/hongquan/Duri","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongquan%2FDuri","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongquan%2FDuri/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongquan%2FDuri/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongquan%2FDuri/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hongquan","download_url":"https://codeload.github.com/hongquan/Duri/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongquan%2FDuri/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267107774,"owners_count":24037322,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api-client","base64","cli","data-uri","image","made-in-vietnam"],"created_at":"2024-12-01T23:28:21.715Z","updated_at":"2025-07-26T02:32:35.414Z","avatar_url":"https://github.com/hongquan.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Duri #\n\n![made-in-vietnam](https://madewithlove.vercel.app/vn?heart=true\u0026colorA=%23ffcd00\u0026colorB=%23da251d)\n[![registry](https://badgen.net/crates/v/duri)](https://crates.io/crates/duri)\n\nCLI tool to get data URI of a file.\n\n![Logo](data/durian.svg)\n\n## Install\n\nDuri is written in [Rust](https://www.rust-lang.org/), so you can install it from [crates.io](https://crates.io/crates/duri):\n\n```console\ncargo install duri\n```\n\n\n## Usage\n\n- Read from file path:\n\n  ```console\n  duri image.png\n  ```\n\n- Read from standard input:\n\n  ```console\n  echo image.png | duri -\n  ```\n\n- To see more option, run with `--help`:\n\n  ```console\n  duri --help\n  ```\n\n## Use cases\n\nAssume that you need to upload file to a RESTful HTTP API. The HTTP API may require posted data to be JSON string and the file content to be in form of base64-encoded [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs).\n\nYou can combine Duri with [jo](https://github.com/jpmens/jo) to build JSON, like:\n\n```console\njo -d. file.name=image.png file.content=$(duri image.png)\n```\n\nthen pass to a CLI HTTP client, like [HTTPie](https://httpie.io/):\n\n```console\njo -d. file.name=image.png file.content=$(duri image.png) | http example-api.vn/ekyc/\n```\n\nThe `duri` + `jo` combo will generate a JSON like\n\n```json\n{\n  \"file\": {\n    \"name\": \"image.png\",\n    \"content\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAABI2...\"\n  }\n}\n\n```\n\nThe string is passed to HTTPie via standard input and HTTPie will build a POST request with that JSON data.\n\nNote that, if your HTTP API requires file to be in plain base64 string, not beginning with `data:xxx`, you don't need Duri.\nIn that case, just use `jo` alone, with its `%` modifier:\n\n```console\njo -d. file.name=image.png file.content=%image.png | http example-api.vn/ekyc/\n```\n\n\nCredit\n------\n\n- Brought to you by [Nguyễn Hồng Quân](https://quan.hoabinh.vn).\n- Icon is from [Freepik](https://www.flaticon.com/free-icon/durian_765534).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhongquan%2Fduri","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhongquan%2Fduri","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhongquan%2Fduri/lists"}