package.go 575 B

1234567891011121314151617181920212223242526272829
  1. package bundle
  2. import (
  3. "os"
  4. "github.com/langgenius/dify-plugin-daemon/internal/utils/log"
  5. )
  6. func PackageBundle(bundlePath string, outputPath string) {
  7. packager, err := loadBundlePackager(bundlePath)
  8. if err != nil {
  9. log.Error("Failed to load bundle packager: %v", err)
  10. return
  11. }
  12. zipFile, err := packager.Export()
  13. if err != nil {
  14. log.Error("Failed to export bundle: %v", err)
  15. return
  16. }
  17. if err := os.WriteFile(outputPath, zipFile, 0644); err != nil {
  18. log.Error("Failed to write zip file: %v", err)
  19. return
  20. }
  21. log.Info("Successfully packaged bundle")
  22. }