JSPM

memen8array

1.0.1
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q21761F
    • License MIT

    Compares the distances between two xor Uint8Array.

    Package Exports

      This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (memen8array) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

      Readme

      About

      Uint8Arrays bring memory-efficient(ish) byte handling to browsers - they are similar to Node.js Buffers but lack a lot of the utility methods present on that class.

      This module exports a number of function that let you do common operations - joining Uint8Array together, seeing if they have the same contents etc.

      Since Node.js Buffers are also Uint8Arrays, it falls back to Buffer internally where it makes sense for performance reasons.

      alloc(size)

      Create a new Uint8Array. When running under Node.js, Buffer will be used in preference to Uint8Array.

      allocUnsafe(size)

      Create a new Uint8Array. When running under Node.js, Buffer will be used in preference to Uint8Array.

      On platforms that support it, memory referenced by the returned Uint8Array will not be initialized.

      Example

      import { allocUnsafe } from 'src/alloc'
      
      const buf = allocUnsafe(100)

      compare(a, b)

      Compare two Uint8Array

      concat(arrays, [length])

      Concatenate one or more Uint8Arrays and return a Uint8Array with their contents.

      If you know the length of the arrays, pass it as a second parameter, otherwise it will be calculated by traversing the list of arrays.

      Example

      import { fromString } from 'uint8arrays/from-string'
      
      console.info(fromString('hello world')) // Uint8Array[104, 101 ...
      console.info(fromString('00010203aabbcc', 'base16')) // Uint8Array[0, 1 ...
      console.info(fromString('AAECA6q7zA', 'base64')) // Uint8Array[0, 1 ...
      console.info(fromString('01234', 'ascii')) // Uint8Array[48, 49 ...

      Example

      import { toString } from 'uint8Array/to-string'
      
      console.info(toString(Uint8Array.from([104, 101...]))) // 'hello world'
      console.info(toString(Uint8Array.from([0, 1, 2...]), 'base16')) // '00010203aabbcc'
      console.info(toString(Uint8Array.from([0, 1, 2...]), 'base64')) // 'AAECA6q7zA'
      console.info(toString(Uint8Array.from([48, 49, 50...]), 'ascii')) // '01234'

      xor(a, b)

      Returns a Uint8Array containing a and b xored together.

      Example

      import { memenxor } from 'xor'
      
      console.info(memenxor(Uint8Array.from([1, 0]), Uint8Array.from([0, 1]))) // Uint8Array[1, 1]
      
      # Install
      
      ```console
      $ npm i memen8Array

      Browser <script> tag

      Loading this module through a script tag will make it's exports available as Uint8Array in the global namespace.

      Contribution

      Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.