This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
PUBLICATION SYSTEM | |
Adding new Author | |
An author will have | |
-> name | |
-> profile | |
Creating A Blog | |
A Blog will have a: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initiate ipfs and CID instance | |
const ipfsClient = require('ipfs-http-client'); | |
const CID = require('cids'); | |
//Connecting ipfs http client instance to local IPFS peer. | |
const ipfs = new ipfsClient({ host: 'localhost', port: '5001', protocol: 'http' }); | |
function errOrLog(err, result) { | |
if (err) { | |
console.error('error: ' + err) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initiate ipfs and CID instance | |
const ipfsClient = require('ipfs-http-client'); | |
const CID = require('cids'); | |
//Connecting ipfs http client instance to local IPFS peer. | |
const ipfs = new ipfsClient({ host: 'localhost', port: '5001', protocol: 'http' }); | |
/* | |
Creating an IPLD format node: | |
ipfs.dag.put(dagNode, [options], [callback]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initiate ipfs and CID instance | |
const ipfsClient = require('ipfs-http-client'); | |
const CID = require('cids'); | |
//Connecting ipfs http client instance to local IPFS peer. | |
const ipfs = new ipfsClient({ host: 'localhost', port: '5001', protocol: 'http' }); | |
/* | |
Creating an IPLD format node: | |
ipfs.dag.put(dagNode, [options], [callback]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Links": [ | |
{ | |
"Name": "", | |
"Hash": "QmYN9f4cRGPReJDSi3YoFTt5eTVS2Jo9ePN3wH3TfgbB8u", | |
"Size": 262158 | |
}, | |
{ | |
"Name": "", | |
"Hash": "QmTJ1rwQQ7FC4HiwmxS1jFe2eJeb6kyxgRWKGyHjf7nYMN", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: Retrieve the Data from the IPFS peer using IPFS Gateway | |
videoSrc.src = `http://localhost:8080/ipfs/${videos[i].hash}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initialize IPFS | |
const ipfs = window.IpfsHttpClient('localhost', '5001') | |
//Checking for File Upload | |
jQuery("input#customFile").change(function (event) { | |
const files = event.target.files; | |
//Converting the FileBlob to ArrayBuffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Youtube on IPFS - SimpleAsWater</title> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" | |
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> | |
<script src="https://unpkg.com/ipfs-http-client/dist/index.min.js"></script> | |
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html => pdf | |
use `html-pdf` module | |
pdf => img | |
use `pdf-image` | |
First install | |
sudo apt-get install imagemagick ghostscript poppler-utils | |
Then add permission for PDF using this: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
/* eslint-disable no-console */ | |
const PeerId = require('peer-id') | |
const PeerInfo = require('peer-info') | |
const Node = require('./libp2p_bundle') | |
const pull = require('pull-stream') | |
const async = require('async') | |
const chalk = require('chalk'); | |
const emoji = require('node-emoji') |