remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/apps/remix-ide/ci/publishIpfs

25 lines
873 B

4 years ago
#!/usr/bin/env node
const all = require('it-all')
const IpfsHttpClient = require('ipfs-http-client')
const { globSource } = IpfsHttpClient
4 years ago
console.log('current folder', process.cwd())
const folder = process.cwd() + '/temp_publish_docker';
(async () => {
const host = 'ipfs.komputing.org' // ethdev berlin ipfs node
const ipfs = IpfsHttpClient({ host, port: 443, protocol: 'https' })
4 years ago
try {
let result = await all(ipfs.add(globSource(folder, { recursive: true}), { pin: false }))
console.log('result ====>', result)
4 years ago
const remoteFolder = result[result.length - 1]
4 years ago
console.log('remoteFolder ====>', remoteFolder)
const hash = remoteFolder.cid.toString()
console.log('ipfs://' + hash)
console.log('https://ipfsgw.komputing.org/ipfs/' + hash)
console.log('https://gateway.ipfs.io/ipfs/' + hash)
4 years ago
} catch (e) {
console.log(e)
}
})()