-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipfstest.js
48 lines (35 loc) · 793 Bytes
/
ipfstest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* import the ipfs-http-client library */
const IPFS = require('ipfs-http-client');
//INFURA TEST
/*
const projectId = '';
const projectSecret = '';
const auth = 'Basic ' + Buffer.from(projectId + ':' + projectSecret).toString('base64')
const client = IPFS.create({
host: 'ipfs.infura.io',
port: 5001,
protocol: 'https',
apiPath: '/api/v0',
headers: {
authorization: auth
}
})*/
// LOCALHOST TEST
/*const client = IPFS.create({
host: 'localhost',
port: 5001,
protocol: 'http',
apiPath: '/api/v0'
})*/
// NGINX CONFIGURATION TEST
const client = IPFS.create({
host: 'ipfs.opensigndapp.com',
port: 443,
protocol: 'https',
apiPath: '/api/v0'
})
async function fun () {
const cid = await client.add("test")
console.log(cid)
}
fun ()