{"id":17823107,"url":"https://github.com/artofcode-/binaryjs","last_synced_at":"2025-06-11T01:32:04.053Z","repository":{"id":25825975,"uuid":"29265243","full_name":"ArtOfCode-/BinaryJS","owner":"ArtOfCode-","description":"Binary handling for Javascript","archived":false,"fork":false,"pushed_at":"2015-01-17T16:36:03.000Z","size":308,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T10:36:12.146Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ArtOfCode-.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}},"created_at":"2015-01-14T20:53:56.000Z","updated_at":"2015-01-17T16:36:04.000Z","dependencies_parsed_at":"2022-07-27T05:32:17.323Z","dependency_job_id":null,"html_url":"https://github.com/ArtOfCode-/BinaryJS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtOfCode-%2FBinaryJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtOfCode-%2FBinaryJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtOfCode-%2FBinaryJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtOfCode-%2FBinaryJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArtOfCode-","download_url":"https://codeload.github.com/ArtOfCode-/BinaryJS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtOfCode-%2FBinaryJS/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259180968,"owners_count":22817840,"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-27T17:51:02.583Z","updated_at":"2025-06-11T01:32:04.031Z","avatar_url":"https://github.com/ArtOfCode-.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BinaryJS\n### Binary handling for Javascript\n\nBinaryJS is a simple library that provides binary conversion functions for both single characters and strings.\n\n#### Encoding  \nYou can use either of the two encoding methods. The first, `encodeString`, is meant for longer strings of text,\nbut will also accept single characters.  To use:\n\n```\n  // Instantiate a new Binary instance\n  var binary = new Binary();\n    \n  // Translate a string of text\n  var translatedText = binary.encodeString(\"HelloWorld!\");\n```\n\nThe other method, `encodeChar` is intended for single characters and **will not work** with anything longer. This method is internally used for `encodeString`. Use:\n\n```\n  // Instantiate a new Binary instance\n  var binary = new Binary();\n  \n  // Translate a single character\n  var translatedChar = binary.encodeChar(\"A\");\n```\n\n#### Decoding  \nAgain, you can use either decoding function, with similar limitations. The first method, `decodeString`, works as \nthe opposite of `encodeString`. Here's an example:\n\n```\n  // Instantiate a new Binary instance\n  var binary = new Binary();\n  \n  // Translate your string\n  var clearText = binary.decodeString(\"0110000101000010\");\n```\n\nAnd lastly, the `decodeChar` method is the opposite number of the `encodeChar` method. Again, it is internally used\n for `decodeString`. It will not accept anything longer than one binary character. Its use:\n \n```\n  // Instantiate a new Binary instance\n  var binary = new Binary();\n  \n  // Translate a single character\n  var clearChar = binary.decodeChar(\"01100001\");\n```\n\n### Some more notes\n\nThere are a few utility methods included in this, which you will see from the source. Although you should not need \nto use them for BinaryJS to work, they are public methods and can be used for other purposes if you wish. (I made \nthem public methods so they are testable).\n\nThere is some character support but not all characters can be encoded yet. The numbers 0-9, spaces, and the symbols \n`+`, `-`, `.` and `,` are supported, but I am adding more. There is also a method to test if a character is supported\nif you're unsure:\n\n```\n  binary.isSupported(\"@\");\n  \n  \u003e\u003e\u003e false\n  \n  binary.isSupported(\" \");    // Space, not an empty string\n  \n  \u003e\u003e\u003e true\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartofcode-%2Fbinaryjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartofcode-%2Fbinaryjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartofcode-%2Fbinaryjs/lists"}