mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-05-29 10:16:39 +00:00
15 lines
440 B
JavaScript
15 lines
440 B
JavaScript
const path = require('path')
|
|
|
|
// Creates a DB manifest file and saves it in IPFS
|
|
const createDBManifest = async (ipfs, name, type, accessControllerAddress) => {
|
|
const manifest = {
|
|
name: name,
|
|
type: type,
|
|
accessController: path.join('/ipfs', accessControllerAddress),
|
|
}
|
|
const dag = await ipfs.object.put(Buffer.from(JSON.stringify(manifest)))
|
|
return dag.toJSON().multihash.toString()
|
|
}
|
|
|
|
module.exports = createDBManifest
|