id3-go icon indicating copy to clipboard operation
id3-go copied to clipboard

Opening read-only files.

Open earboxer opened this issue 4 years ago • 1 comments

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?

earboxer avatar Dec 11 '20 05:12 earboxer

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

richdawe avatar Jun 14 '23 14:06 richdawe