| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| var _endianness; |
| export function endianness() { |
| if (typeof _endianness === 'undefined') { |
| var a = new ArrayBuffer(2); |
| var b = new Uint8Array(a); |
| var c = new Uint16Array(a); |
| b[0] = 1; |
| b[1] = 2; |
| if (c[0] === 258) { |
| _endianness = 'BE'; |
| } else if (c[0] === 513){ |
| _endianness = 'LE'; |
| } else { |
| throw new Error('unable to figure out endianess'); |
| } |
| } |
| return _endianness; |
| } |
|
|
| export function hostname() { |
| if (typeof global.location !== 'undefined') { |
| return global.location.hostname |
| } else return ''; |
| } |
|
|
| export function loadavg() { |
| return []; |
| } |
|
|
| export function uptime() { |
| return 0; |
| } |
|
|
| export function freemem() { |
| return Number.MAX_VALUE; |
| } |
|
|
| export function totalmem() { |
| return Number.MAX_VALUE; |
| } |
|
|
| export function cpus() { |
| return []; |
| } |
|
|
| export function type() { |
| return 'Browser'; |
| } |
|
|
| export function release () { |
| if (typeof global.navigator !== 'undefined') { |
| return global.navigator.appVersion; |
| } |
| return ''; |
| } |
|
|
| export function networkInterfaces(){} |
| export function getNetworkInterfaces(){} |
|
|
| export function arch() { |
| return 'javascript'; |
| } |
|
|
| export function platform() { |
| return 'browser'; |
| } |
|
|
| export function tmpDir() { |
| return '/tmp'; |
| } |
| export var tmpdir = tmpDir; |
|
|
| export var EOL = '\n'; |
| export default { |
| EOL: EOL, |
| tmpdir: tmpdir, |
| tmpDir: tmpDir, |
| networkInterfaces:networkInterfaces, |
| getNetworkInterfaces: getNetworkInterfaces, |
| release: release, |
| type: type, |
| cpus: cpus, |
| totalmem: totalmem, |
| freemem: freemem, |
| uptime: uptime, |
| loadavg: loadavg, |
| hostname: hostname, |
| endianness: endianness, |
| } |
|
|