Client for the nyats (Not Yet Another Thumbnail Service) IPFS thumbnailing server.
npm i -S nyats-client
The library consists of 2 functions:
Returns URL to load pre-existing thumbnails from cache. This URL will return a 404 if it does not, in which case a thumbnail will need to be generated.
Returns a URL used to generate a thumbnail. If succesful, a redirect to an IPFS gateway is returned. The type
parameter is optional and can be used to skip mimetype detection on the server. Allowed values are: image
, video
, document
and audio
.
Please see demo/index.html for a minimal example implementation in pure HTML5/JS.
In the default configuration, this library uses ipfs-search.com testing environment. There are no guarantees that we will continue this service and without prior permission, commercial usage is not allowed. You are free to run your own server, in which case the configuration can be set in two different ways:
import {GetClient} from "nyats-client";
const client = GetClient({
endpoint: "<API ENDPOINT>",
gatewayURL: "<IPFS GATEWAY>",
ipnsRoot: "/ipns/<PEER ID>/",
});
client.IPNSThumbnailURL(...);
import {DefaultConfig, IPNSThumbnailURL, GenerateThumbnailURL} from "nyats-client";
DefaultConfig.endpoint = "<API ENDPOINT>";
DefaultConfig.gatewayURL = "<IPFS GATEWAY>";
DefaultConfig.ipnsRoot = "/ipns/<PEER ID>/";
IPNSThumbnailURL(...);
To run your own server (recommended), check out nyats-server.
There are no guarantees provided and commercial usage is not allowed. Please contact us at [email protected] if you are interested in production-scale usage.