{"id":18817869,"url":"https://github.com/vitorluizc/use-object-url","last_synced_at":"2025-06-13T09:33:36.623Z","repository":{"id":44975700,"uuid":"205711903","full_name":"VitorLuizC/use-object-url","owner":"VitorLuizC","description":"React Hook to create and revoke URL for any instance of `File`, `Blob` or `MediaSource`.","archived":false,"fork":false,"pushed_at":"2022-12-10T00:43:08.000Z","size":859,"stargazers_count":12,"open_issues_count":18,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T06:35:47.801Z","etag":null,"topics":["hacktoberfest","javascript","react","react-hook","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/VitorLuizC.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":"2019-09-01T17:47:30.000Z","updated_at":"2024-10-10T22:25:17.000Z","dependencies_parsed_at":"2023-01-25T20:30:59.956Z","dependency_job_id":null,"html_url":"https://github.com/VitorLuizC/use-object-url","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"VitorLuizC/typescript-library-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitorLuizC%2Fuse-object-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitorLuizC%2Fuse-object-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitorLuizC%2Fuse-object-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitorLuizC%2Fuse-object-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VitorLuizC","download_url":"https://codeload.github.com/VitorLuizC/use-object-url/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248795356,"owners_count":21162755,"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":["hacktoberfest","javascript","react","react-hook","typescript"],"created_at":"2024-11-08T00:13:46.006Z","updated_at":"2025-04-13T23:25:18.654Z","avatar_url":"https://github.com/VitorLuizC.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# useObjectURL\n\n[![Build Status](https://travis-ci.org/VitorLuizC/use-object-url.svg?branch=master)](https://travis-ci.org/VitorLuizC/use-object-url)\n[![License](https://badgen.net/github/license/VitorLuizC/use-object-url)](./LICENSE)\n[![Library minified size](https://badgen.net/bundlephobia/min/use-object-url)](https://bundlephobia.com/result?p=use-object-url)\n[![Library minified + gzipped size](https://badgen.net/bundlephobia/minzip/use-object-url)](https://bundlephobia.com/result?p=use-object-url)\n\nReact Hook that receives an instance of `File`, `Blob` or `MediaSource` and creates an URL representing it. It releases URL when component unmount or parameter changes.\n\n```js\nimport useObjectURL from 'use-object-url';\n\nconst DownloadFileLink = ({ file, filename }) =\u003e {\n  const { objectURL } = useObjectURL(file);\n\n  return (\n    \u003ca href={objectURL} target=\"_blank\" download={filename}\u003e\n      Download\n    \u003c/a\u003e\n  );\n};\n```\n\n## Installation\n\nThis library is published in the NPM registry and can be installed using any compatible package manager.\n\n```sh\nnpm install use-object-url --save\n\n# For Yarn, use the command below.\nyarn add use-object-url\n```\n\n### Installation from CDN\n\nThis module has an UMD bundle available through JSDelivr and Unpkg CDNs.\n\n```html\n\u003c!-- For UNPKG use the code below. --\u003e\n\u003cscript src=\"https://unpkg.com/use-object-url\"\u003e\u003c/script\u003e\n\n\u003c!-- For JSDelivr use the code below. --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/use-object-url\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n  function PreviewImage(props) {\n    // UMD module is exposed through the \"useObjectURL\" function.\n    var { objectURL } = useObjectURL(props.uploadedImage);\n\n    return React.createElement('img', {\n      src: objectURL,\n      alt: 'Uploaded image',\n      title: 'Preview of uploaded image.'\n    });\n  }\n\u003c/script\u003e\n```\n\n## Documentation\n\n[Documentation generated from source files by Typedoc](./docs/README.md).\n\n## License\n\nReleased under [MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitorluizc%2Fuse-object-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitorluizc%2Fuse-object-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitorluizc%2Fuse-object-url/lists"}