Example #1
0
func catFile(fileHash string) (string, error) {
	var hash string
	var err error
	if logger.Level > 0 {
		hash, err = ipfs.CatFromIPFS(fileHash, logger.Writer)
	} else {
		hash, err = ipfs.CatFromIPFS(fileHash, bytes.NewBuffer([]byte{}))
	}
	if err != nil {
		return "", err
	}
	return hash, nil
}
Example #2
0
func catFile(fileHash string) (string, error) {
	var hash string
	var err error
	if log.GetLevel() > 0 {
		hash, err = ipfs.CatFromIPFS(fileHash, os.Stdout)
	} else {
		hash, err = ipfs.CatFromIPFS(fileHash, bytes.NewBuffer([]byte{}))
	}
	if err != nil {
		return "", err
	}
	return hash, nil
}