{"name":"uint8arrays","version":"3.0.0-rc.0","description":"Utility functions to make dealing with Uint8Arrays easier","main":"src/index.js","author":{"name":"Alex Potsides","email":"alex@achingbrain.net"},"homepage":"https://github.com/achingbrain/uint8arrays","bugs":{"url":"https://github.com/achingbrain/uint8arrays/issues"},"type":"module","types":"types/src/index.d.ts","repository":{"type":"git","url":"git+https://github.com/achingbrain/uint8arrays.git"},"scripts":{"test":"aegir test","lint":"aegir ts -p check && aegir lint","release":"aegir release","release-minor":"aegir release --type minor","release-major":"aegir release --type major","build":"aegir build"},"license":"MIT","dependencies":{"multiformats":"^9.4.2"},"devDependencies":{"aegir":"^35.0.0","util":"^0.12.4"},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"},"ignorePatterns":["!.aegir.js"]},"typesVersions":{"*":{"*":["types/src","types/src/*"]}},"exports":{".":{"import":"./src/index.js"},"./compare":{"import":"./src/compare.js"},"./concat":{"import":"./src/concat.js"},"./equals":{"import":"./src/equals.js"},"./from-string":{"import":"./src/from-string.js"},"./to-string":{"import":"./src/to-string.js"},"./xor":{"import":"./src/xor.js"}},"contributors":[{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"Irakli Gozalishvili","email":"contact@gozala.io"},{"name":"Cayman","email":"caymannava@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Mircea Nistor","email":"mirceanis@gmail.com"},{"name":"Rafael Ramalho","email":"rafazelramalho19@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"}],"readme":"# Uint8Arrays <!-- omit in toc -->\n\nSome utility functions to make dealing with `Uint8Array`s more pleasant.\n\n- [API](#api)\n  - [compare(a, b)](#comparea-b)\n    - [Example](#example)\n  - [concat(arrays, [length])](#concatarrays-length)\n    - [Example](#example-1)\n  - [equals(a, b)](#equalsa-b)\n    - [Example](#example-2)\n  - [fromString(string, encoding = 'utf8')](#fromstringstring-encoding--utf8)\n    - [Example](#example-3)\n  - [toString(array, encoding = 'utf8')](#tostringarray-encoding--utf8)\n    - [Example](#example-4)\n  - [xor(a, b)](#xora-b)\n    - [Example](#example-5)\n\n## API\n\n### compare(a, b)\n\nCompare two `Uint8Arrays`\n\n#### Example\n\n```js\nimport { compare } from 'uint8arrays/compare'\n\nconst arrays = [\n  Uint8Array.from([3, 4, 5]),\n  Uint8Array.from([0, 1, 2])\n]\n\nconst sorted = arrays.sort(compare)\n\nconsole.info(sorted)\n// [\n//    Uint8Array[0, 1, 2]\n//    Uint8Array[3, 4, 5]\n// ]\n```\n\n### concat(arrays, [length])\n\nConcatenate one or more array-likes and return a `Uint8Array` with their contents.\n\nIf you know the length of the arrays, pass it as a second parameter, otherwise it will be calculated by traversing the list of arrays.\n\n#### Example\n\n```js\nimport { concat } from 'uint8arrays/concat'\n\nconst arrays = [\n  Uint8Array.from([0, 1, 2]),\n  Uint8Array.from([3, 4, 5])\n]\n\nconst all = concat(arrays, 6)\n\nconsole.info(all)\n// Uint8Array[0, 1, 2, 3, 4, 5]\n```\n\n### equals(a, b)\n\nReturns true if the two arrays are the same array or if they have the same length and contents.\n\n#### Example\n\n```js\nimport { equals } from 'uint8arrays/equals'\n\nconst a = Uint8Array.from([0, 1, 2])\nconst b = Uint8Array.from([3, 4, 5])\nconst c = Uint8Array.from([0, 1, 2])\n\nconsole.info(equals(a, b)) // false\nconsole.info(equals(a, c)) // true\nconsole.info(equals(a, a)) // true\n```\n\n### fromString(string, encoding = 'utf8')\n\nReturns a new `Uint8Array` created from the passed string and interpreted as the passed encoding.\n\nSupports `utf8` and any of the [multibase encodings](https://github.com/multiformats/multibase/blob/master/multibase.csv) as implemented by the [multiformats module](https://www.npmjs.com/package/multiformats).\n\n#### Example\n\n```js\nimport { fromString } from 'uint8arrays/from-string'\n\nconsole.info(fromString('hello world')) // Uint8Array[104, 101 ...\nconsole.info(fromString('00010203aabbcc', 'base16')) // Uint8Array[0, 1 ...\nconsole.info(fromString('AAECA6q7zA', 'base64')) // Uint8Array[0, 1 ...\nconsole.info(fromString('01234', 'ascii')) // Uint8Array[48, 49 ...\n```\n\n### toString(array, encoding = 'utf8')\n\nReturns a string created from the passed `Uint8Array` in the passed encoding.\n\nSupports `utf8` and any of the [multibase encodings](https://github.com/multiformats/multibase/blob/master/multibase.csv) as implemented by the [multiformats module](https://www.npmjs.com/package/multiformats).\n\n#### Example\n\n```js\nimport { toString } from 'uint8arrays/to-string'\n\nconsole.info(toString(Uint8Array.from([104, 101...]))) // 'hello world'\nconsole.info(toString(Uint8Array.from([0, 1, 2...]), 'base16')) // '00010203aabbcc'\nconsole.info(toString(Uint8Array.from([0, 1, 2...]), 'base64')) // 'AAECA6q7zA'\nconsole.info(toString(Uint8Array.from([48, 49, 50...]), 'ascii')) // '01234'\n```\n\n### xor(a, b)\n\nReturns a `Uint8Array` containing `a` and `b` xored together.\n\n#### Example\n\n```js\nimport { xor } from 'uint8arrays/xor'\n\nconsole.info(xor(Uint8Array.from([1, 0]), Uint8Array.from([0, 1]))) // Uint8Array[1, 1]\n```\n","readmeFilename":"README.md","gitHead":"81642f37f89b3d08e96ddeba236443829b3001fa","_id":"uint8arrays@3.0.0-rc.0","_nodeVersion":"14.16.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-kyLvT1D8UgNdhR7O2Sc0poAjz4Y+obd95kD9drUf6GZs3NuAQcoSmRpePm78T6NdktrrmrN7OZBDxcrZKcXHBw==","shasum":"9686f04545eadb6d67ed2537b201e98b17313417","tarball":"http://registry-npm.ywwl.com/uint8arrays/download/uint8arrays-3.0.0-rc.0.tgz","fileCount":20,"unpackedSize":24611,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhGmJhCRA9TVsSAnZWagAAZlsP/1CEYDiCLqJnTrrTCRDr\nDU0nRDFBPQqiIl2vB0IikyTNPh3i621gBB8vllDnuYCnpQXBZlWeqzi6T+Lz\nppOnva955hY5Qb5MqlcKoXfaH9prz16BctmIV/xQ8WDKf3CfrZZVypexV9qm\nJ2+nQR+v0Pr1DNvk46ZviMp5mdOEJ8VOKfaZbDwUbQzOFdxhWO0sV+gvGamK\njA8PzSrpxBUKEwgdz9HLItcgXn2cUE6J7KkSpP9JOgAopMxWIkbR8fdGkxqT\nDdnkbMuJX0R2LYMgQQ7mHmsQk7kPxsq3s1SObwkKidDzEEUvFzX979udX/Uf\nW4fVIcCvOrXWR+ACISLEpavzQzoXexvsOToFNZ6SUxTpBToYgcUDfKMRelOm\nc+kDX0/lS2e1WMLEkHvvUF+4gglBQ475KhYhqgooQs1Vl3p6QEk+dnqSwarB\nj6DWKbm5DEL/TJ+dZCOsl0bloDdcmQN0HWSC7bWLEu+bZ28plMpSWe3Ph1AP\n765AwPwo5yiJVExVV55KHH4Ob4YD/UWU2TM2YabUmK5yF5Eh/nGmLPk7f91E\nUywwmpsHbzt0f2iW9ef0W1ogRnd6d8/qePCzsFrcugHfmyjTJ/jga9qrc00j\nH+N8NvJO5BsDEXoIdlNf4Vgs3UR/8jt8fjTSdnXrjGE8v7JCDhhq8Gp4Qb5E\nNr5w\r\n=6Tfm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCG79Eq0g1wp8+9Dyb7BcusJuOVknLnh5HwTB38r1OSDAIgThJf8qx11vIAgKMLxFYS1T9RNf7Wt5Qlloqk+6IPJ+U="}],"size":6485,"noattachment":false,"key":"/uint8arrays/-/uint8arrays-3.0.0-rc.0.tgz"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"achingbrain","email":"alex@achingbrain.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/uint8arrays_3.0.0-rc.0_1629119073521_0.8771875216310996"},"_hasShrinkwrap":false,"publish_time":1629119073675,"_cnpm_publish_time":1629119073675,"dist-tags":{"latest":"6.1.1","next":"3.0.0-rc.1"}}