summaryrefslogtreecommitdiff
path: root/node_modules/rollup-plugin-node-polyfills/polyfills/os.js
diff options
context:
space:
mode:
authorakiyamn2023-09-24 23:22:21 +1000
committerakiyamn2023-09-24 23:22:21 +1000
commit4e87195739f2a5d9a05451b48773c8afdc680765 (patch)
tree9cba501844a4a11dcbdffc4050ed8189561c55ed /node_modules/rollup-plugin-node-polyfills/polyfills/os.js
downloadprice-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.tar.gz
price-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.zip
Initial commit (by create-cloudflare CLI)
Diffstat (limited to 'node_modules/rollup-plugin-node-polyfills/polyfills/os.js')
-rw-r--r--node_modules/rollup-plugin-node-polyfills/polyfills/os.js113
1 files changed, 113 insertions, 0 deletions
diff --git a/node_modules/rollup-plugin-node-polyfills/polyfills/os.js b/node_modules/rollup-plugin-node-polyfills/polyfills/os.js
new file mode 100644
index 0000000..761bd02
--- /dev/null
+++ b/node_modules/rollup-plugin-node-polyfills/polyfills/os.js
@@ -0,0 +1,113 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 CoderPuppy
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+*/
+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,
+}