eternity-ipfs
v0.0.5
Published
Store data eternally with Arweave and IPFS
Downloads
3
Readme
Eternity-ipfs: An NPM package to interact with the Eternity API
Eternity-ipfs is a tiny NPM package to interact with Eternity, an API server you can use to store data eternally on Arweave's Blockchain just by providing an IPFS file hash.
This NPM package is a simple alternative to making API calls to Eternity manually using an HTTP client such as Axios or Fetch. It works on both client and server side.
Installation
It's as easy as:
sudo npm install eternity-ipfs
Usage
You'll need Eternity running locally or at any available endpoint.
Import and Init Eternity-ipfs:
const Eternity = require('eternity-ipfs').Eternity;
// OR
import { Eternity } from "eternity-ipfs";
// init with the default endpoint (http://localhost:5000)
let eternity = new Eternity();
// Or init with a specific Eternity endpoint
let eternity = new Eternity('https://eternity.example.com');
Store data eternally on Arweave's Blockchain with an IPFS file hash:
let main = async () => {
let data = await eternity.newdata("<IPFS file hash>");
console.log(data);
// {"status": "success"}
}
main();
Get stored data on Arweave's Blockchain using an IPFS file hash:
let main = async () => {
let data = await eternity.getdata("<IPFS file hash>");
console.log(data);
// {"data": "base64..."}
}
main();