{"id":29565630,"url":"https://github.com/michaelwp/binaryconverter","last_synced_at":"2025-12-31T14:31:22.187Z","repository":{"id":284707131,"uuid":"955790639","full_name":"michaelwp/binaryConverter","owner":"michaelwp","description":"A simple Go library for converting between decimal and binary numbers.","archived":false,"fork":false,"pushed_at":"2025-03-27T08:19:48.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T09:19:13.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/michaelwp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2025-03-27T07:48:24.000Z","updated_at":"2025-03-27T08:17:42.000Z","dependencies_parsed_at":"2025-03-28T09:19:13.709Z","dependency_job_id":null,"html_url":"https://github.com/michaelwp/binaryConverter","commit_stats":null,"previous_names":["michaelwp/binaryconverter","michaelwp/binary-converter"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/michaelwp/binaryConverter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FbinaryConverter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FbinaryConverter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FbinaryConverter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FbinaryConverter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelwp","download_url":"https://codeload.github.com/michaelwp/binaryConverter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2FbinaryConverter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265837734,"owners_count":23836558,"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":"2025-07-18T21:34:58.527Z","updated_at":"2025-12-31T14:31:22.154Z","avatar_url":"https://github.com/michaelwp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Binary Converter\n\nA simple Go library for converting between decimal and binary numbers.\n\n## Installation\n\n```sh\ngo get github.com/michaelwp/binaryConverter\n```\n\n## Usage\n\nImport the package and use the `BinaryConverter` interface to convert between decimal and binary formats.\n\n### Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/michaelwp/binaryConverter\"\n)\n\nfunc main() {\n\tconverter := binaryConverter.NewBinaryConverter()\n\n\t// Convert decimal to binary\n\tbinary := converter.ToBinary(42)\n\tfmt.Println(\"Binary of 42:\", binary) // Output: \"101010\"\n\n\t// Convert binary to decimal\n\tdecimal, err := converter.ToDecimal(\"101010\")\n\tif err != nil {\n\t\tfmt.Println(\"Error:\", err)\n\t} else {\n\t\tfmt.Println(\"Decimal of 101010:\", decimal) // Output: 42\n\t}\n}\n```\n\n## API Reference\n\n### `ToBinary(decimal int64) string`\nConverts a decimal number to a binary string.\n\n- **Input:** `int64`\n- **Output:** `string`\n\n**Example:**\n```go\nconverter.ToBinary(10) // Output: \"1010\"\n```\n\n### `ToDecimal(binary string) (int64, error)`\nConverts a binary string to a decimal number.\n\n- **Input:** `string` (must be a valid binary representation)\n- **Output:** `int64, error`\n\n**Example:**\n```go\ndecimal, err := converter.ToDecimal(\"1010\") // Output: 10, nil\n```\n\n## Error Handling\nIf the input binary string is invalid, `ToDecimal` returns an error.\n```go\n_, err := converter.ToDecimal(\"102\")\nif err != nil {\n    fmt.Println(\"Invalid binary string:\", err)\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwp%2Fbinaryconverter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelwp%2Fbinaryconverter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwp%2Fbinaryconverter/lists"}