{"version":3,"sources":["../../src/storage/ipfs/hash.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,oBAAY,QAAQ,GAAG,MAAM,CAAC;AAE9B,wBAA8B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAMrE","file":"hash.d.ts","sourcesContent":["/**\n * @module \"ethpm/storage/ipfs\"\n */\n\nimport { promisify } from 'util';\n\nconst Unixfs = require('ipfs-unixfs');\nconst { DAGNode } = require('ipld-dag-pb');\n\nexport type IpfsHash = string;\n\nexport default async function hash(content: string): Promise<IpfsHash> {\n  const data = Buffer.from(content, 'ascii');\n  const unixFs = new Unixfs('file', data);\n\n  const dagNode = await promisify(DAGNode.create)(unixFs.marshal());\n  return dagNode.toJSON().multihash;\n}\n"]}