func ImportChain(do *definitions.Do) error { fileName := filepath.Join(BlockchainsPath, do.Name) if filepath.Ext(fileName) == "" { fileName = fileName + ".toml" } s := strings.Split(do.Path, ":") if s[0] == "ipfs" { var err error if logger.Level > 0 { err = util.GetFromIPFS(s[1], fileName, logger.Writer) } else { err = util.GetFromIPFS(s[1], fileName, bytes.NewBuffer([]byte{})) } if err != nil { return err } return nil } if strings.Contains(s[0], "github") { logger.Println("https://twitter.com/ryaneshea/status/595957712040628224") return nil } return fmt.Errorf("I do not know how to get that file. Sorry.") }
func importFile(hash, fileName string) error { var err error if logger.Level > 0 { err = util.GetFromIPFS(hash, fileName, logger.Writer) } else { err = util.GetFromIPFS(hash, fileName, bytes.NewBuffer([]byte{})) } if err != nil { return err } return nil }