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

23 lines
692 B

#!/usr/bin/env node
const IpfsHttpClient = require('ipfs-http-client')
const { globSource } = IpfsHttpClient
const folder = process.cwd() + '/dist/apps/remix-ide';
(async () => {
const host = 'ipfs.infura.io'
const projectId = process.argv[2]
const projectSecret = process.argv[3]
const auth = 'Basic ' + Buffer.from(projectId + ':' + projectSecret).toString('base64')
const ipfs = IpfsHttpClient({ port: 5001, host, protocol: 'https', headers: {
authorization: auth
} })
try {
let result = await ipfs.add(globSource(folder, { recursive: true}), { pin: false })
const hash = result.cid.toString()
console.log(hash)
} catch (e) {
console.log(e)
}
})()