{"id":23709450,"url":"https://github.com/vishakh-abhayan/imagebindb","last_synced_at":"2026-05-07T09:31:30.125Z","repository":{"id":209317527,"uuid":"723726149","full_name":"vishakh-abhayan/ImageBinDB","owner":"vishakh-abhayan","description":"Essential for Local Image Handling in Browsers and PWAs","archived":false,"fork":false,"pushed_at":"2023-11-27T09:09:18.000Z","size":150,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-20T07:14:18.549Z","etag":null,"topics":["binary","image","image-processing","javascript","npm"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/imagebindb","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/vishakh-abhayan.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":"2023-11-26T15:27:37.000Z","updated_at":"2023-11-28T16:10:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"e26eac43-c6a4-4497-8cd3-a640d0558853","html_url":"https://github.com/vishakh-abhayan/ImageBinDB","commit_stats":null,"previous_names":["vishakh-abhayan/imagebindb"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishakh-abhayan%2FImageBinDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishakh-abhayan%2FImageBinDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishakh-abhayan%2FImageBinDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishakh-abhayan%2FImageBinDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vishakh-abhayan","download_url":"https://codeload.github.com/vishakh-abhayan/ImageBinDB/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239793065,"owners_count":19697893,"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":["binary","image","image-processing","javascript","npm"],"created_at":"2024-12-30T18:29:52.517Z","updated_at":"2026-02-05T10:30:14.733Z","avatar_url":"https://github.com/vishakh-abhayan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ImageBinDB ✶\n\n![bin](https://github.com/vishakh-abhayan/ImageBinDB/assets/94307781/6ebf1f13-dfa1-4adb-afff-0767b9868b26)\n\n## Introduction\n\nA a NPM module designed for converting images to binary data, storing them in IndexedDB, and retrieving and converting them back to images. It's an ideal solution for web applications that require efficient image handling and storage using browser technologies.\n\n## Transform Your Web App's Image Management\n\n`ImageBinDB` is a cutting-edge TypeScript NPM module, uniquely designed to revolutionize the way web applications and Progressive Web Apps (PWAs) handle images locally. It's the perfect solution for scenarios where traditional methods fall short.\n\n## Why ImageBinDB?\n\nIn the landscape of web development, efficiently managing and processing images locally in a browser or PWA has always been challenging. `ImageBinDB` steps in as a game-changer, offering unparalleled functionalities:\n\n### 🌟 Key Features\n\n- **Effortless Image to Binary Conversion**: Seamlessly convert images to binary data, bypassing the usual complexities of local image handling.\n- **Robust IndexedDB Storage**: Leverage the power of IndexedDB for reliable and efficient storage and retrieval of your binary image data.\n- **Smooth Binary to Image Conversion**: Transform binary data back into images effortlessly, maintaining the integrity and quality of your visuals.\n\n## Installation\n\n```bash\nnpm install imagebindb\n```\n\n### Importing the Module\n\n```javascript\nimport {\n  imageToBinary,\n  storeImage,\n  retrieveImage,\n  binaryToImageURL,\n} from \"imagebindb\";\n```\n\n### Converting an Image to Binary\n\n```javascript\nconst imageFile = document.getElementById(\"input\").files[0];\nimageToBinary(imageFile).then((binaryData) =\u003e {\n  // Handle the binary data\n});\n```\n\n### Storing Binary Data in IndexedDB\n\n```javascript\nstoreImage(\"myDatabase\", \"myImageKey\", binaryData).then(() =\u003e\n  console.log(\"Image stored successfully\")\n);\n```\n\n### Retrieving Binary Data from IndexedDB\n\n```javascript\nretrieveImage(\"myDatabase\", \"myImageKey\").then((binaryData) =\u003e {\n  if (binaryData) {\n    // Handle the retrieved binary data\n  }\n});\n```\n\n### Converting Binary Data Back to an Image URL\n\n```javascript\nconst imageUrl = binaryToImageURL(binaryData);\n// Use the image URL (e.g., as the src of an img element)\n```\n\n## API Reference\n\nThis section details the functions available in the `ImageBinDB` module, along with their descriptions and usage.\n\n### `imageToBinary(image: File): Promise\u003cArrayBuffer\u003e`\n\nConverts an image file to binary data.\n\n**Parameters:**\n\n- `image`: `File` - The image file to convert.\n\n**Returns:**\n\n- `Promise\u003cArrayBuffer\u003e` - A promise that resolves with the binary data.\n\n---\n\n### `storeImage(dbName: string, key: string, data: ArrayBuffer): Promise\u003cvoid\u003e`\n\nStores binary data in IndexedDB.\n\n**Parameters:**\n\n- `dbName`: `string` - The name of the IndexedDB database.\n- `key`: `string` - The key under which to store the data.\n- `data`: `ArrayBuffer` - The binary data to be stored.\n\n**Returns:**\n\n- `Promise\u003cvoid\u003e`\n\n---\n\n### `retrieveImage(dbName: string, key: string): Promise\u003cArrayBuffer | undefined\u003e`\n\nRetrieves binary data from IndexedDB.\n\n**Parameters:**\n\n- `dbName`: `string` - The name of the IndexedDB database.\n- `key`: `string` - The key under which the data is stored.\n\n**Returns:**\n\n- `Promise\u003cArrayBuffer | undefined\u003e` - A promise that resolves with the retrieved binary data or undefined if the key is not found.\n\n---\n\n### `binaryToImageURL(binaryData: ArrayBuffer): string`\n\nConverts binary data to an image URL.\n\n**Parameters:**\n\n- `binaryData`: `ArrayBuffer` - The binary data to be converted.\n\n**Returns:**\n\n- `string` - The image URL created from the binary data.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any features or fixes.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishakh-abhayan%2Fimagebindb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvishakh-abhayan%2Fimagebindb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishakh-abhayan%2Fimagebindb/lists"}