1.1.8 • Published 2 years ago

redstone-isomorphic v1.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

redstone-isomorphic

redstone-isomorphic is a fork of isomorphic-fetch.

fetch

It adds fetch as global so its API is consistent between client and server. It uses standard fetch() method on client's side and undici - which is an http client written for Node.js - on server's side.

Buffer

It provides Buffer object with API consistent between server and client. It uses safe-buffer library for node environment and buffer for browser.

Installation

NPM

npm install --save redstone-isomorphic

YARN

yarn add redstone-isomorphic

Usage

fetch

import "redstone-isomorphic";

fetch("//api.redstone.finance")
  .then(function (response) {
    if (response.status >= 400) {
      throw new Error("Bad response from server");
    }
    return response.json();
  })
  .then(function (data) {
    console.log(data);
  });

Buffer

import { Buffer } from "redstone-isomorphic";

const arr = new Uint16Array(2);

arr[0] = 5000;
arr[1] = 4000;

const buf = Buffer.from(arr.buffer);
1.1.8

2 years ago

1.1.7

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago