{"id":17736620,"url":"https://github.com/parro-it/file-to-datauri","last_synced_at":"2025-07-10T01:33:48.535Z","repository":{"id":36806179,"uuid":"41113023","full_name":"parro-it/file-to-datauri","owner":"parro-it","description":"Convert local files into data uris with ease.","archived":false,"fork":false,"pushed_at":"2015-08-20T19:32:14.000Z","size":120,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-13T02:51:42.012Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/parro-it.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":"2015-08-20T18:43:22.000Z","updated_at":"2019-07-08T22:08:21.000Z","dependencies_parsed_at":"2022-09-15T04:41:17.952Z","dependency_job_id":null,"html_url":"https://github.com/parro-it/file-to-datauri","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Ffile-to-datauri","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Ffile-to-datauri/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Ffile-to-datauri/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Ffile-to-datauri/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parro-it","download_url":"https://codeload.github.com/parro-it/file-to-datauri/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246523847,"owners_count":20791444,"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":[],"created_at":"2024-10-26T00:23:45.540Z","updated_at":"2025-03-31T19:17:08.000Z","avatar_url":"https://github.com/parro-it.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# file-to-datauri\n\nConvert local files into data uris with ease.\n\n## Installation\n\n```bash\nnpm install --save file-to-datauri\n```\n\n## How it works\n\nRead the file, either sync or async, find mime\nusing file extension, and return file content\nencoded as data-uri.\n\nOnly support utf8 encoded files.\n\n## Usage\n\n```javascript\n  import datauri from 'file-to-datauri'\n\n  // use with a callback\n  datauri(__dirname + '/some/file.txt', (err, uri) =\u003e {\n    if (err) {\n      return;\n    }\n    console.log(uri);\n  });\n\n  // use with promise (if no callback given)\n  (async () =\u003e {\n    const uri = datauri(__dirname + '/some/file.txt');\n    console.log(uri);\n  })();\n\n\n  // use sync\n  const uri = datauri.sync(__dirname + '/some/file.txt');\n  console.log(uri);\n\n\n```\n\n## Credits\n\nInspired by [data-uri](https://github.com/mcwhittemore/data-uri)\n\n## License\nThe MIT License (MIT)\n\nCopyright (c) 2015 Andrea Parodi\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Ffile-to-datauri","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparro-it%2Ffile-to-datauri","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Ffile-to-datauri/lists"}