{"id":18862809,"url":"https://github.com/eik-lib/sink","last_synced_at":"2025-07-25T09:09:19.334Z","repository":{"id":38119251,"uuid":"256467823","full_name":"eik-lib/sink","owner":"eik-lib","description":"The storage sink interface used by Eik","archived":false,"fork":false,"pushed_at":"2025-07-01T06:26:43.000Z","size":126,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-01T07:29:09.467Z","etag":null,"topics":["eik","eik-sink"],"latest_commit_sha":null,"homepage":"https://eik.dev","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eik-lib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"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,"zenodo":null}},"created_at":"2020-04-17T10:05:14.000Z","updated_at":"2025-07-01T06:26:33.000Z","dependencies_parsed_at":"2023-10-31T05:26:13.423Z","dependency_job_id":"c7eda984-a13f-4fe5-a204-945d40a44285","html_url":"https://github.com/eik-lib/sink","commit_stats":{"total_commits":171,"total_committers":6,"mean_commits":28.5,"dds":"0.26315789473684215","last_synced_commit":"09c728a3bb6d9eab7bdba03d2d2ad91b0f3dbf3d"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/eik-lib/sink","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eik-lib%2Fsink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eik-lib%2Fsink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eik-lib%2Fsink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eik-lib%2Fsink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eik-lib","download_url":"https://codeload.github.com/eik-lib/sink/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eik-lib%2Fsink/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266983523,"owners_count":24016559,"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-25T02:00:09.625Z","response_time":70,"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":["eik","eik-sink"],"created_at":"2024-11-08T04:35:48.712Z","updated_at":"2025-07-25T09:09:19.290Z","avatar_url":"https://github.com/eik-lib.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @eik/sink\n\nA sink interface defining the public sink API in Eik.\n\n[![Dependencies](https://img.shields.io/david/eik-lib/sink.svg)](https://david-dm.org/eik-lib/sink)\n[![GitHub Actions status](https://github.com/eik-lib/sink/workflows/Run%20Lint%20and%20Tests/badge.svg)](https://github.com/eik-lib/sink/actions?query=workflow%3A%22Run+Lint+and+Tests%22)\n[![Known Vulnerabilities](https://snyk.io/test/github/eik-lib/sink/badge.svg?targetFile=package.json)](https://snyk.io/test/github/eik-lib/sink?targetFile=package.json)\n\nThe intention of the [Eik][eik] sink modules is to be able to write to and read from\nfiles in different storage backends by swapping sink modules. Because each sink\nimplements the same public API it is possible to use this sink in one environment and\nanother sink in a different environment. This is an interface containing the\npublic API each sink has to implement.\n\n## Installation\n\n```bash\n$ npm install @eik/sink\n```\n\n## Example\n\nImplement a custom sink:\n\n```js\nconst { ReadFile } = require('@eik/common');\nconst Sink = require('@eik/sink');\n\nconst SinkCustom = class SinkCustom extends Sink {\n    constructor() {\n        super();\n    }\n\n    write(filePath, contentType) {\n        return new Promise((resolve, reject) =\u003e {\n            try {\n                super.constructor.validateFilePath(filePath);\n                super.constructor.validateContentType(contentType);\n            } catch (error) {\n                reject(error);\n                return;\n            }\n\n            // Custom code\n\n            resolve();\n        });\n    }\n\n    read(filePath) {\n        return new Promise((resolve, reject) =\u003e {\n            try {\n                super.constructor.validateFilePath(filePath);\n            } catch (error) {\n                reject(error);\n                return;\n            }\n\n            // Custom code\n\n            const obj = new ReadFile();\n            resolve(obj);\n        });\n    }\n\n    delete(filePath) {\n        return new Promise((resolve, reject) =\u003e {\n            try {\n                super.constructor.validateFilePath(filePath);\n            } catch (error) {\n                reject(error);\n                return;\n            }\n\n            // Custom code\n\n            resolve();\n        });\n    }\n\n    exist(filePath) {\n        return new Promise((resolve, reject) =\u003e {\n            try {\n                super.constructor.validateFilePath(filePath);\n            } catch (error) {\n                reject(error);\n                return;\n            }\n\n            // Custom code\n\n            resolve();\n        });\n    }\n\n    get metrics() {\n        return // Custom metric stream code\n    }\n\n    get [Symbol.toStringTag]() {\n        return 'SinkCustom';\n    }\n}\n```\n\n## License\n\nCopyright (c) 2020 FINN.no\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n[eik]: https://github.com/eik-lib\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feik-lib%2Fsink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feik-lib%2Fsink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feik-lib%2Fsink/lists"}