{"id":17771418,"url":"https://github.com/rootslab/bice","last_synced_at":"2025-08-22T16:06:21.350Z","repository":{"id":24594284,"uuid":"28002623","full_name":"rootslab/bice","owner":"rootslab","description":"Bice, a tiny module that offers a fast way to swap arbitrary length sequences of bytes within a Buffer, using only the Buffer itself and the bitwise XOR operator.","archived":false,"fork":false,"pushed_at":"2015-01-20T02:57:07.000Z","size":204,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T02:29:57.858Z","etag":null,"topics":["buffer","swapping"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/rootslab.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-14T17:57:23.000Z","updated_at":"2020-10-10T04:41:08.000Z","dependencies_parsed_at":"2022-08-23T00:50:56.648Z","dependency_job_id":null,"html_url":"https://github.com/rootslab/bice","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/rootslab/bice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fbice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fbice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fbice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fbice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rootslab","download_url":"https://codeload.github.com/rootslab/bice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Fbice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271664984,"owners_count":24799298,"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-08-22T02:00:08.480Z","response_time":65,"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":["buffer","swapping"],"created_at":"2024-10-26T21:32:48.379Z","updated_at":"2025-08-22T16:06:21.284Z","avatar_url":"https://github.com/rootslab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Bice\n\n[![NPM VERSION](http://img.shields.io/npm/v/bice.svg?style=flat)](https://www.npmjs.org/package/bice)\n[![CODACY BADGE](https://img.shields.io/codacy/b18ed7d95b0a4707a0ff7b88b30d3def.svg?style=flat)](https://www.codacy.com/public/44gatti/bice)\n[![CODECLIMATE](http://img.shields.io/codeclimate/github/rootslab/bice.svg?style=flat)](https://codeclimate.com/github/rootslab/bice)\n[![CODECLIMATE-TEST-COVERAGE](https://img.shields.io/codeclimate/coverage/github/rootslab/bice.svg?style=flat)](https://codeclimate.com/github/rootslab/bice)\n[![LICENSE](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/rootslab/bice#mit-license)\n\n[![TRAVIS CI BUILD](http://img.shields.io/travis/rootslab/bice.svg?style=flat)](http://travis-ci.org/rootslab/bice)\n[![BUILD STATUS](http://img.shields.io/david/rootslab/bice.svg?style=flat)](https://david-dm.org/rootslab/bice)\n[![DEVDEPENDENCY STATUS](http://img.shields.io/david/dev/rootslab/bice.svg?style=flat)](https://david-dm.org/rootslab/bice#info=devDependencies)\n[![NPM DOWNLOADS](http://img.shields.io/npm/dm/bice.svg?style=flat)](http://npm-stat.com/charts.html?package=bice)\n\n[![NPM GRAPH1](https://nodei.co/npm-dl/bice.png)](https://nodei.co/npm/bice/)\n\n[![NPM GRAPH2](https://nodei.co/npm/bice.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/bice/)\n\n[![status](https://sourcegraph.com/api/repos/github.com/rootslab/bice/.badges/status.png)](https://sourcegraph.com/github.com/rootslab/bice)\n[![views](https://sourcegraph.com/api/repos/github.com/rootslab/bice/.counters/views.png)](https://sourcegraph.com/github.com/rootslab/bice)\n[![views 24h](https://sourcegraph.com/api/repos/github.com/rootslab/bice/.counters/views-24h.png)](https://sourcegraph.com/github.com/rootslab/bice)\n\n\u003e __Bice__, a tiny module that offers a fast way to swap arbitrary length sequences of bytes within a Buffer, using only the Buffer itself and the bitwise __XOR__ operator.\n\n###Install\n\n```bash\n$ npm install bice [-g]\n```\n\n\u003e __require__ returns an helper hash/obj.\n\n```javascript\nvar Bice  = require( 'bice' );\n```\n###Run Tests\n\n\u003e __to run all test files, install devDependecies:__\n\n```bash\n $ cd bice/\n # install or update devDependecies \n $ npm install --dev\n # run tests\n $ npm test\n```\n\u003e __to execute a single test file simply do__:\n\n```bash\n $ node test/file-name.js\n```\n\n### Methods\n\n\u003e Arguments within [ ] are optional.\n\n```javascript\n/*\n * Swap 2 sequences in a Buffer, swapping 1 byte at the time.\n * It returns true if swapping was successfull, false otherwise.\n *\n * NOTE:\n * - sequences shouldn't overlap.\n * - sequences shouldn't overflow Buffer length.\n * - sequence 1 starts from pos1 and ends to pos1 + bytes - 1.\n * - sequence 2 starts from pos2 and ends to pos2 + bytes - 1.\n * - pos1 could be \u003e than pos2, the order of indexes doesn't matter.\n */\nBice#swap : function ( Buffer buffer, Number pos1, Number pos2 , Number bytes ) : Boolean\n\n/*\n * Reverse an entire Buffer or a part of it, swapping 1 byte at the time.\n * It returns true if reversing was successfull, false otherwise.\n */\nBice#reverse : function ( Buffer buffer [, Number pos [, Number bytes ] ] ) : Boolean\n\n/*\n * Compares values from 2 buffers.\n * Optionally, it accepts the number of bytes to read; if it is not specified,\n * it compares a number of bytes equals to the length of the smaller Buffer.\n *\n * It returns:\n *\n * -  0 when b1 === b2\n * - +1 when b1 \u003e b2\n * - -1 when b1 \u003c b2\n * - null otherwise (read index overflow, 0-length Buffers, ..)\n *\n */\nBice#compare : function ( Buffer b1, Number p1, Buffer b2, Number p2 [, Number bytes ] ) : Number\n```\n\n### MIT License\n\n\u003e Copyright (c) 2014 \u0026lt; Guglielmo Ferri : 44gatti@gmail.com \u0026gt;\n\n\u003e Permission is hereby granted, free of charge, to any person obtaining\n\u003e a copy of this software and associated documentation files (the\n\u003e 'Software'), to deal in the Software without restriction, including\n\u003e without limitation the rights to use, copy, modify, merge, publish,\n\u003e distribute, sublicense, and/or sell copies of the Software, and to\n\u003e permit persons to whom the Software is furnished to do so, subject to\n\u003e the following conditions:\n\n\u003e __The above copyright notice and this permission notice shall be\n\u003e included in all copies or substantial portions of the Software.__\n\n\u003e THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n\u003e EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\u003e MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n\u003e IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n\u003e CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n\u003e TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n\u003e SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[![GA](https://ga-beacon.appspot.com/UA-53998692-1/bice/Readme?pixel)](https://github.com/igrigorik/ga-beacon)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootslab%2Fbice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frootslab%2Fbice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootslab%2Fbice/lists"}