Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexbakers/ipfs-storage

IPFS storage API providers.
https://github.com/alexbakers/ipfs-storage

filebase fleek ipfs ipfs-api ipfs-protocol ipfs-web lighthouse pinata storage web3 web3storage

Last synced: 5 days ago
JSON representation

IPFS storage API providers.

Awesome Lists containing this project

README

        

# IPFS STORAGE API PROVIDERS

IPFS STORAGE API PROVIDERS

- [x] Filebase [filebase.com]
- [x] Fleek [fleek.co]
- [x] Web3 [web3.storage]
- [x] Pinata [pinata.cloud]
- [x] Lighthouse [lighthouse.storage]

## Examples

### FILEBASE

```javascript
fs.readFile(join(__dirname, "..", "banner.png"), async (err, data) => {
if (err) {
console.log("🆘 ERROR:", err);
return;
}

if (!process.env.FILEBASE_KEY) {
console.log("🆘 ERROR:", "Create .env file");
return;
}

try {
const url = await uploadFile.filebase(
{
key: process.env.FILEBASE_KEY,
secret: process.env.FILEBASE_SECRET,
bucket: process.env.FILEBASE_BUCKET,
},
{
hash: "banner",
ext: ".png",
buffer: data,
}
);
console.log("✅ FILEBASE:", url);
await deleteFile.filebase(
{
key: process.env.FILEBASE_KEY,
secret: process.env.FILEBASE_SECRET,
bucket: process.env.FILEBASE_BUCKET,
},
{
hash: "banner",
ext: ".png",
}
);
} catch (err) {
console.log("🆘 FILEBASE:", err);
}
});
```

### PINATA

```javascript
fs.readFile(join(__dirname, "..", "banner.png"), async (err, data) => {
if (err) {
console.log("🆘 ERROR:", err);
return;
}

if (!process.env.PINATA_JWT) {
console.log("🆘 ERROR:", "Create .env file");
return;
}

try {
const url = await uploadFile.pinata(
{
jwt: process.env.PINATA_JWT,
},
{
hash: "banner",
ext: ".png",
buffer: data,
}
);
console.log("✅ PINATA:", url);
await deleteFile.pinata(
{
jwt: process.env.PINATA_JWT,
},
{
url,
}
);
} catch (err) {
console.log("🆘 PINATA:", err);
}
});
```

### FLEEK

```javascript
fs.readFile(join(__dirname, "..", "banner.png"), async (err, data) => {
if (err) {
console.log("🆘 ERROR:", err);
return;
}

if (!process.env.FLEEK_KEY) {
console.log("🆘 ERROR:", "Create .env file");
return;
}

try {
const url = await uploadFile.fleek(
{
key: process.env.FLEEK_KEY,
secret: process.env.FLEEK_SECRET,
bucket: process.env.FLEEK_BUCKET,
},
{
hash: "banner",
ext: ".png",
buffer: data,
}
);
console.log("✅ FLEEK:", url);
await deleteFile.fleek(
{
key: process.env.FLEEK_KEY,
secret: process.env.FLEEK_SECRET,
bucket: process.env.FLEEK_BUCKET,
},
{
hash: "banner",
ext: ".png",
}
);
} catch (err) {
console.log("🆘 FLEEK:", err);
}
});
```

### WEB3

```javascript
fs.readFile(join(__dirname, "..", "banner.png"), async (err, data) => {
if (err) {
console.log("🆘 ERROR:", err);
return;
}

if (!process.env.WEB3_TOKEN) {
console.log("🆘 ERROR:", "Create .env file");
return;
}

try {
const url = await uploadFile.web3(
{
token: process.env.WEB3_TOKEN,
},
{
hash: "banner",
ext: ".png",
buffer: data,
}
);
console.log("✅ WEB3:", url);
await deleteFile.web3(
{
token: process.env.WEB3_TOKEN,
},
{
url,
}
);
} catch (err) {
console.log("🆘 WEB3:", err);
}
});
```

### LIGHTHOUSE

```javascript
fs.readFile(join(__dirname, "..", "banner.png"), async (err, data) => {
if (err) {
console.log("🆘 ERROR:", err);
return;
}

if (!process.env.LIGHTHOUSE_TOKEN) {
console.log("🆘 ERROR:", "Create .env file");
return;
}

try {
const url = await uploadFile.lighthouse(
{
token: process.env.LIGHTHOUSE_TOKEN,
},
{
hash: "banner",
ext: ".png",
buffer: data,
}
);
console.log("✅ LIGHTHOUSE:", url);
await deleteFile.lighthouse(
{
token: process.env.LIGHTHOUSE_TOKEN,
},
{
url,
}
);
} catch (err) {
console.log("🆘 LIGHTHOUSE:", err);
}
});
```

---

`(c)` Alex Baker