How to use typedarray - 10 common examples

To help you get started, we’ve selected a few typedarray examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github improbable-eng / grpc-web / test / ts / src / grpc.spec.ts View on Github external
// Polyfills
import {debug} from "../../../ts/src/debug";

const global = Function('return this')();

if (typeof Uint8Array === "undefined") {
  (global as any).Uint8Array = require("typedarray").Uint8Array;
}
if (typeof ArrayBuffer === "undefined") {
  (global as any).ArrayBuffer = require("typedarray").ArrayBuffer;
}
if (typeof DataView === "undefined") {
  (global as any).DataView = require("typedarray").DataView;
}

// Test Config
import {assert} from "chai";
import {
  testHost,
  corsHost
} from "../../hosts-config";
type TestConfig = {
  testHostUrl: string,
  corsHostUrl: string,
  unavailableHost: string,
  emptyHost: string,
github improbable-eng / grpc-web / test / ts / src / grpc.spec.ts View on Github external
// Polyfills
import {debug} from "../../../ts/src/debug";

const global = Function('return this')();

if (typeof Uint8Array === "undefined") {
  (global as any).Uint8Array = require("typedarray").Uint8Array;
}
if (typeof ArrayBuffer === "undefined") {
  (global as any).ArrayBuffer = require("typedarray").ArrayBuffer;
}
if (typeof DataView === "undefined") {
  (global as any).DataView = require("typedarray").DataView;
}

// Test Config
import {assert} from "chai";
import {
  testHost,
  corsHost
} from "../../hosts-config";
type TestConfig = {
  testHostUrl: string,
  corsHostUrl: string,
  unavailableHost: string,
  emptyHost: string,
}
const http1Config: TestConfig = {
  testHostUrl: `https://${testHost}:9100`,
github crypto-browserify / sha.js / test / write.js View on Github external
var a = new TA.Uint8Array(string.length)
  for(var i = 0; i < string.length; i++)
    a[i] = string.charCodeAt(i)
  return a
}

var zero = '0'.charCodeAt(0)
var A    = 'a'.charCodeAt(0)

var HELLOTHERE = new TA.Uint8Array([
    104, 101, 108, 108,
    111, 32, 116, 104,
    101, 114, 101, 46
  ])

var FOOBARBAZ = new TA.Uint8Array([
    102, 111, 111,
    98, 97, 114,
    98, 97, 112
  ])

var FOO = toBuffer('foo')
var BAR = toBuffer('bar')
var BAZ = toBuffer('baz')

var FOO64 = FOO.toString('base64')
var BAR64 = BAR.toString('base64')
var BAZ64 = BAZ.toString('base64')

var FOOx = FOO.toString('hex')
var BARx = BAR.toString('hex')
var BAZx = BAZ.toString('hex')
github splunk / splunk-sdk-javascript / node_modules / concat-stream / index.js View on Github external
function u8Concat (parts) {
  var len = 0
  for (var i = 0; i < parts.length; i++) {
    if (typeof parts[i] === 'string') {
      parts[i] = bufferFrom(parts[i])
    }
    len += parts[i].length
  }
  var u8 = new U8(len)
  for (var i = 0, offset = 0; i < parts.length; i++) {
    var part = parts[i]
    for (var j = 0; j < part.length; j++) {
      u8[offset++] = part[j]
    }
  }
  return u8
}
github maxogden / concat-stream / index.js View on Github external
function u8Concat (parts) {
  var len = 0
  for (var i = 0; i < parts.length; i++) {
    if (typeof parts[i] === 'string') {
      parts[i] = bufferFrom(parts[i])
    }
    len += parts[i].length
  }
  var u8 = new U8(len)
  for (var i = 0, offset = 0; i < parts.length; i++) {
    var part = parts[i]
    for (var j = 0; j < part.length; j++) {
      u8[offset++] = part[j]
    }
  }
  return u8
}
github sx1989827 / DOClever / node_modules / concat-stream / index.js View on Github external
function u8Concat (parts) {
  var len = 0
  for (var i = 0; i < parts.length; i++) {
    if (typeof parts[i] === 'string') {
      parts[i] = bufferFrom(parts[i])
    }
    len += parts[i].length
  }
  var u8 = new U8(len)
  for (var i = 0, offset = 0; i < parts.length; i++) {
    var part = parts[i]
    for (var j = 0; j < part.length; j++) {
      u8[offset++] = part[j]
    }
  }
  return u8
}
github devinhalladay / devinhalladay.com / node_modules / concat-stream / index.js View on Github external
function u8Concat (parts) {
  var len = 0
  for (var i = 0; i < parts.length; i++) {
    if (typeof parts[i] === 'string') {
      parts[i] = new Buffer(parts[i])
    }
    len += parts[i].length
  }
  var u8 = new U8(len)
  for (var i = 0, offset = 0; i < parts.length; i++) {
    var part = parts[i]
    for (var j = 0; j < part.length; j++) {
      u8[offset++] = part[j]
    }
  }
  return u8
}
github rac2030 / MakeZurich / MoBiFloC / web / node_modules / concat-stream / index.js View on Github external
function u8Concat (parts) {
  var len = 0
  for (var i = 0; i < parts.length; i++) {
    if (typeof parts[i] === 'string') {
      parts[i] = new Buffer(parts[i])
    }
    len += parts[i].length
  }
  var u8 = new U8(len)
  for (var i = 0, offset = 0; i < parts.length; i++) {
    var part = parts[i]
    for (var j = 0; j < part.length; j++) {
      u8[offset++] = part[j]
    }
  }
  return u8
}
github appcelerator / titanium_mobile / node_modules / appc-aar-tools / node_modules / extract-zip-fork / node_modules / concat-stream / index.js View on Github external
function u8Concat (parts) {
  var len = 0
  for (var i = 0; i < parts.length; i++) {
    if (typeof parts[i] === 'string') {
      parts[i] = Buffer(parts[i])
    }
    len += parts[i].length
  }
  var u8 = new U8(len)
  for (var i = 0, offset = 0; i < parts.length; i++) {
    var part = parts[i]
    for (var j = 0; j < part.length; j++) {
      u8[offset++] = part[j]
    }
  }
  return u8
}
github ranjithprabhuk / ng2-Dashboard / node_modules / concat-stream / index.js View on Github external
function u8Concat (parts) {
  var len = 0
  for (var i = 0; i < parts.length; i++) {
    if (typeof parts[i] === 'string') {
      parts[i] = Buffer(parts[i])
    }
    len += parts[i].length
  }
  var u8 = new U8(len)
  for (var i = 0, offset = 0; i < parts.length; i++) {
    var part = parts[i]
    for (var j = 0; j < part.length; j++) {
      u8[offset++] = part[j]
    }
  }
  return u8
}

typedarray

TypedArray polyfill for old browsers

MIT
Latest version published 2 years ago

Package Health Score

71 / 100
Full package analysis