Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
result = ambient
break
case 'ir':
result = js.irParser.parse(ambient)
break
default:
result = js.parse(ambient)
break
}
// --display flag
// -o option
if (argv.display) return process.stdout.write(result)
if (argv.o) return fs.writeFileSync(argv.o, result)
const hash = await io.write(ipfs, 'dag-cbor', result)
return hash
}
const createDBManifest = async (ipfs, name, type, accessControllerAddress, options) => {
const manifest = Object.assign({
name: name,
type: type,
accessController: (path.posix || path).join('/ipfs', accessControllerAddress)
},
// meta field is only added to manifest if options.meta is defined
options.meta !== undefined ? { meta: options.meta } : {}
)
return io.write(ipfs, options.format || 'dag-cbor', manifest, options)
}
if (!head) {
console.warn("Warning: Given input entry was 'null'.")
return Promise.resolve(null)
}
const identityProvider = this.identity.provider
if (!identityProvider) throw new Error('Identity-provider is required, cannot verify entry')
const canAppend = await this.access.canAppend(head, identityProvider)
if (!canAppend) {
console.warn('Warning: Given input entry is not allowed in this log and was discarded (no write access).')
return Promise.resolve(null)
}
const logEntry = Entry.toEntry(head)
const hash = await io.write(this._ipfs, Entry.getWriteFormat(logEntry), logEntry, { links: Entry.IPLD_LINKS, onlyHash: true })
if (hash !== head.hash) {
console.warn('"WARNING! Head hash didn\'t match the contents')
}
return head
}