Blazing fast IPFS JSON pinning with replication on multiple pinning services.
Pineapple.js was designed to work both in the browser and in Node.js.
To install Pineapple.js on Node.js, open your terminal and run:
npm install @snapshot-labs/pineapple
You can create an index.html file and include Pineapple.js with:
<script src="https://cdn.jsdelivr.net/npm/@snapshot-labs/pineapple"></script>
import { pin } from '@snapshot-labs/pineapple';
// Pin JSON
const obj = { foo: 'bar' };
const receipt = await pin(obj);
console.log(receipt);
On success, it returns a receipt object:
{
provider: 'infura',
cid: 'xxxxx'
}
On error, it will return an error object like this:
{
error: {
code: 400,
message: 'File too big',
data: {}
}
}
- On NodeJS, you can set the env variable
FETCH_KEEP_ALIVE
totrue
to enable keep-alive connections. - Functions have a timeout of 10s.
MIT.