{"id":13412812,"url":"https://github.com/kdomanski/iso9660","last_synced_at":"2025-03-14T18:32:22.895Z","repository":{"id":34036793,"uuid":"143653491","full_name":"kdomanski/iso9660","owner":"kdomanski","description":"A go library for reading and creating ISO9660 images","archived":false,"fork":false,"pushed_at":"2024-01-23T08:23:05.000Z","size":150,"stargazers_count":273,"open_issues_count":14,"forks_count":44,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-05T21:01:44.804Z","etag":null,"topics":["cdrom","iso","iso9660"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kdomanski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-05T22:56:26.000Z","updated_at":"2025-02-12T06:37:53.000Z","dependencies_parsed_at":"2023-12-21T15:58:49.443Z","dependency_job_id":"1d18bb84-166c-4e46-ae48-e00304bba280","html_url":"https://github.com/kdomanski/iso9660","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdomanski%2Fiso9660","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdomanski%2Fiso9660/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdomanski%2Fiso9660/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdomanski%2Fiso9660/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdomanski","download_url":"https://codeload.github.com/kdomanski/iso9660/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243625182,"owners_count":20321249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdrom","iso","iso9660"],"created_at":"2024-07-30T20:01:29.517Z","updated_at":"2025-03-14T18:32:22.412Z","avatar_url":"https://github.com/kdomanski.png","language":"Go","funding_links":[],"categories":["Go","File Handling","others","文件处理"],"sub_categories":["Search and Analytic Databases","检索及分析资料库"],"readme":"## iso9660\n[![Go Reference](https://pkg.go.dev/badge/github.com/kdomanski/iso9660.svg)](https://pkg.go.dev/github.com/kdomanski/iso9660)\n[![codecov](https://codecov.io/gh/kdomanski/iso9660/branch/master/graph/badge.svg?token=14MJSZYZ24)](https://codecov.io/gh/kdomanski/iso9660)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kdomanski/iso9660)](https://goreportcard.com/report/github.com/kdomanski/iso9660)\n\nA package for reading and creating ISO9660\n\nJoliet extension is **NOT** supported.\n\nExperimental support for reading Rock Ridge extension is currently in the works.\nIf you are experiencing issues, please use the v0.3 release, which ignores Rock Ridge.\n\n## References for the format:\n- [ECMA-119 1st edition (December 1986)](https://www.ecma-international.org/wp-content/uploads/ECMA-119_1st_edition_december_1986.pdf) ([Web Archive link](http://web.archive.org/web/20210122025258/https://www.ecma-international.org/wp-content/uploads/ECMA-119_1st_edition_december_1986.pdf))\n- [ECMA-119 2nd edition (December 1987)](https://www.ecma-international.org/wp-content/uploads/ECMA-119_2nd_edition_december_1987.pdf) ([Web Archive link](http://web.archive.org/web/20210418211711/https://www.ecma-international.org/wp-content/uploads/ECMA-119_2nd_edition_december_1987.pdf))\n- [ECMA-119 3rd edition (December 2017)](https://www.ecma-international.org/wp-content/uploads/ECMA-119_3rd_edition_december_2017.pdf) ([Web Archive link](http://web.archive.org/web/20210527165925/https://www.ecma-international.org/wp-content/uploads/ECMA-119_3rd_edition_december_2017.pdf))\n- [ECMA-119 4th edition (June 2019)](https://www.ecma-international.org/wp-content/uploads/ECMA-119_4th_edition_june_2019.pdf) ([Web Archive link](https://www.ecma-international.org/wp-content/uploads/ECMA-119_4th_edition_june_2019.pdf))\n- [Rock Ridge Interchange Protocol](http://www.nextcomputers.org/NeXTfiles/Projects/CD-ROM/Rock_Ridge_Interchange_Protocol.pdf) ([Web Archive link](http://web.archive.org/web/20071017082049/http://www.nextcomputers.org/NeXTfiles/Projects/CD-ROM/Rock_Ridge_Interchange_Protocol.pdf))\n- [System Use Sharing Protocol v1.12](http://aminet.net/package/docs/misc/RRIP)\n\n## Examples\n\n### Extracting an ISO\n\n```go\npackage main\n\nimport (\n  \"log\"\n\n  \"github.com/kdomanski/iso9660/util\"\n)\n\nfunc main() {\n  f, err := os.Open(\"/home/user/myImage.iso\")\n  if err != nil {\n    log.Fatalf(\"failed to open file: %s\", err)\n  }\n  defer f.Close()\n\n  if err = util.ExtractImageToDirectory(f, \"/home/user/target_dir\"); err != nil {\n    log.Fatalf(\"failed to extract image: %s\", err)\n  }\n}\n```\n\n### Creating an ISO\n\n```go\npackage main\n\nimport (\n  \"log\"\n  \"os\"\n\n  \"github.com/kdomanski/iso9660\"\n)\n\nfunc main() {\n  writer, err := iso9660.NewWriter()\n  if err != nil {\n    log.Fatalf(\"failed to create writer: %s\", err)\n  }\n  defer writer.Cleanup()\n\n  f, err := os.Open(\"/home/user/myFile.txt\")\n  if err != nil {\n    log.Fatalf(\"failed to open file: %s\", err)\n  }\n  defer f.Close()\n\n  err = writer.AddFile(f, \"folder/MYFILE.TXT\")\n  if err != nil {\n    log.Fatalf(\"failed to add file: %s\", err)\n  }\n\n  outputFile, err := os.OpenFile(\"/home/user/output.iso\", os.O_WRONLY | os.O_TRUNC | os.O_CREATE, 0644)\n  if err != nil {\n    log.Fatalf(\"failed to create file: %s\", err)\n  }\n\n  err = writer.WriteTo(outputFile, \"testvol\")\n  if err != nil {\n    log.Fatalf(\"failed to write ISO image: %s\", err)\n  }\n\n  err = outputFile.Close()\n  if err != nil {\n    log.Fatalf(\"failed to close output file: %s\", err)\n  }\n}\n```\n\n### Recursively create an ISO image from the given directories\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n  \"log\"\n  \"os\"\n  \"path/filepath\"\n  \"strings\"\n\n  \"github.com/kdomanski/iso9660\"\n)\n\nfunc main() {\n  writer, err := iso9660.NewWriter()\n  if err != nil {\n    log.Fatalf(\"failed to create writer: %s\", err)\n  }\n  defer writer.Cleanup()\n\n  isoFile, err := os.OpenFile(\"C:/output.iso\", os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644)\n  if err != nil {\n    log.Fatalf(\"failed to create file: %s\", err)\n  }\n  defer isoFile.Close()\n\n  prefix := \"F:\\\\\" // the prefix to remove in the output iso file\n  sourceFolders := []string{\"F:\\\\test1\", \"F:\\\\test2\"} // the given directories to create an ISO file from\n\n  for _, folderName := range sourceFolders {\n    folderPath := strings.Join([]string{prefix, folderName}, \"/\")\n\n    walk_err := filepath.Walk(folderPath, func(path string, info os.FileInfo, err error) error {\n      if err != nil {\n        log.Fatalf(\"walk: %s\", err)\n        return err\n      }\n      if info.IsDir() {\n        return nil\n      }\n      outputPath := strings.TrimPrefix(path, prefix) // remove the source drive name\n      fmt.Printf(\"Adding file: %s\\n\", outputPath)\n\n      fileToAdd, err := os.Open(path)\n      if err != nil {\n        log.Fatalf(\"failed to open file: %s\", err)\n      }\n      defer fileToAdd.Close()\n\n      err = writer.AddFile(fileToAdd, outputPath)\n      if err != nil {\n        log.Fatalf(\"failed to add file: %s\", err)\n      }\n      return nil\n    })\n    if walk_err != nil {\n      log.Fatalf(\"%s\", walk_err)\n    }\n  }\n\n  err = writer.WriteTo(isoFile, \"Test\")\n  if err != nil {\n    log.Fatalf(\"failed to write ISO image: %s\", err)\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdomanski%2Fiso9660","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdomanski%2Fiso9660","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdomanski%2Fiso9660/lists"}