multihash.ts 602 B

12345678910111213141516171819202122232425
  1. import { Command, flags } from '@oclif/command'
  2. import { hashFile } from '../../services/helpers/hashing'
  3. export default class DevMultihash extends Command {
  4. static description = 'Creates a multihash (blake3) for a file.'
  5. static flags = {
  6. help: flags.help({ char: 'h' }),
  7. file: flags.string({
  8. char: 'f',
  9. required: true,
  10. description: 'Path for a hashing file.',
  11. }),
  12. }
  13. async run(): Promise<void> {
  14. const { flags } = this.parse(DevMultihash)
  15. console.log(`Hashing ${flags.file}`)
  16. const multi = await hashFile(flags.file)
  17. console.log(multi)
  18. }
  19. }