{"id":18835375,"url":"https://github.com/danieldickison/endianness","last_synced_at":"2026-01-26T20:30:16.202Z","repository":{"id":139621539,"uuid":"159717461","full_name":"danieldickison/endianness","owner":"danieldickison","description":":cyclone: Swap endianness in byte arrays.","archived":false,"fork":false,"pushed_at":"2018-11-29T19:51:12.000Z","size":766,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-30T07:44:16.846Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rochars/endianness","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danieldickison.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":"2018-11-29T19:33:38.000Z","updated_at":"2023-08-08T19:12:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"2495f113-0d20-4d4f-9567-ca2c6d4d95f1","html_url":"https://github.com/danieldickison/endianness","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieldickison%2Fendianness","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieldickison%2Fendianness/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieldickison%2Fendianness/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieldickison%2Fendianness/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danieldickison","download_url":"https://codeload.github.com/danieldickison/endianness/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239770037,"owners_count":19693985,"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-11-08T02:16:00.609Z","updated_at":"2026-01-26T20:30:13.887Z","avatar_url":"https://github.com/danieldickison.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# endianness\nCopyright (c) 2017-2018 Rafael da Silva Rocha.  \nhttps://github.com/rochars/endianness  \n\n[![NPM version](https://img.shields.io/npm/v/endianness.svg?style=for-the-badge)](https://www.npmjs.com/package/endianness) [![Docs](https://img.shields.io/badge/docs-online-blue.svg?style=for-the-badge)](https://rochars.github.io/endianness/docs/index.html) [![Tests](https://img.shields.io/badge/tests-online-blue.svg?style=for-the-badge)](https://rochars.github.io/endianness/test/dist/browser.html)  \n[![Codecov](https://img.shields.io/codecov/c/github/rochars/endianness.svg?style=flat-square)](https://codecov.io/gh/rochars/endianness) [![Unix Build](https://img.shields.io/travis/rochars/endianness.svg?style=flat-square)](https://travis-ci.org/rochars/endianness) [![Windows Build](https://img.shields.io/appveyor/ci/rochars/endianness.svg?style=flat-square\u0026logo=appveyor)](https://ci.appveyor.com/project/rochars/endianness) [![Scrutinizer](https://img.shields.io/scrutinizer/g/rochars/endianness.svg?style=flat-square\u0026logo=scrutinizer)](https://scrutinizer-ci.com/g/rochars/endianness/)\n\nSwap endianness in byte arrays. The input buffer is modified in place.\n\n- **MIT licensed**\n- **Compatible with IE6+ and browsers that support ES3/ES5/ES6+**\n- **Use it out of the box in Node.js**\n- **Use it out of the box with [TypeScript](https://www.typescriptlang.org/)**\n- **Use it with any byte offset**\n- **Swap entire buffers**\n- **Swap only a slice of the buffer**\n\n## Install\n```\nnpm install endianness\n```\n\n## Use\n\n### Browser\nUse **endianness.umd.js**:\n```html\n\u003cscript src=\"endianness.umd.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    var bytes = [64, 9, 33, 251, 84, 68, 45, 24]; \n    endianness(bytes, 8);\n    console.log(bytes);\n\u003c/script\u003e\n```\n\nOr get it from the [jsDelivr](https://www.jsdelivr.com/npm/endianness) CDN:\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/endianness\"\u003e\u003c/script\u003e\n```\n\nOr get it from [unpkg](https://www.unpkg.com/endianness):\n```html\n\u003cscript src=\"https://unpkg.com/endianness\"\u003e\u003c/script\u003e\n```\n\n#### Browser compatibility\n**endianness.umd.js** is transpiled to ES3 and compatible with IE6+. Should work in all modern browsers that support ES3/ES5/ES6+.\n\nCross-browser tests powered by  \n\u003ca href=\"https://www.browserstack.com\"\u003e\u003cimg src=\"https://rochars.github.io/endianness/docs/Browserstack-logo@2x.png\" width=\"150px\"/\u003e\u003c/a\u003e\n\n### Node\nRequire or import **endianness** from **endianness**:\n```javascript\nimport endianness from 'endianness';\n\n// Swap endianness of one 64-bit value:\nlet bytes = [64, 9, 33, 251, 84, 68, 45, 24];\nendianness(bytes, 8);\n```\n\n```javascript\nconst endianness = require(\"endianness\");\n\n// Swap endianness of two 24-bit values:\nlet bytes = new Uint8Array([\"00\", \"00\", \"80\", \"ff\", \"ff\", \"7f\"]);\nendianness(bytes, 3),\n```\n\n## API\n```javascript\n/**\n * Swap the byte ordering in a buffer. The buffer is modified in place.\n * @param {!Array\u003cnumber|string\u003e|!Uint8Array} bytes The bytes.\n * @param {number} offset The byte offset.\n * @param {number=} index The start index. Assumes 0.\n * @param {number=} end The end index. Assumes the buffer length.\n * @throws {Error} If the buffer length is not valid.\n */\nfunction endianness(bytes, offset, index=0, end=bytes.length) {}\n```\n\n## LICENSE\nCopyright (c) 2017-2018 Rafael da Silva Rocha.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanieldickison%2Fendianness","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanieldickison%2Fendianness","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanieldickison%2Fendianness/lists"}