Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening read-only files. #38

Open
earboxer opened this issue Dec 11, 2020 · 1 comment
Open

Opening read-only files. #38

earboxer opened this issue Dec 11, 2020 · 1 comment

Comments

@earboxer
Copy link

Currently, opening a read-only file fails. This is because id3.Open opens the files in read write mode (os.OpenFile(name, os.O_RDWR, 0666)).

One thought I had would be to fallback on read-only mode if readwrite mode fails. Then we could just throw an error if someone tries to write to the object. (is it still considered a breaking change if it changes when an error is given?)

Probably the least offensive change would be adding another function, maybe called Read, which would be just like Load, except with os.O_RDONLY. Would that be more confusing?

@richdawe
Copy link

I think you can achieve something similar by opening the file read-only and then passing it to id3.Parse(), https://github.com/mikkyang/id3-go/blob/master/id3.go#L50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants