aadsm / jsmediatags

Media Tags Reader (ID3, MP4, FLAC)
Other
757 stars 127 forks source link

Error: Offset 87722 hasn't been loaded yet. #29

Closed tom-sherman closed 7 years ago

tom-sherman commented 8 years ago

I don't know if this is any way related to issue #14

Code:

var tags = fs.readdir(dir, function (err, files) {
  if (!err) {
    files.forEach(function (element) {
      jsmediatags.read(dir + element, {
        onSuccess: function (tag) {
          console.log(tag)
        },
        onError: function (tagError) {
          console.log('tagError:(', tagError.type, tagError.info)
        }
      })
    })
  } else {
    console.log(err)
  }
})

Trace:

Error: Offset 87722 hasn't been loaded yet.
    at ChunkedFileData.getByteAt (~/node_modules/jsmediatags/build2/ChunkedFileData.js:185:11)
    at NodeFileReader.getByteAt (~/node_modules/jsmediatags/build2/NodeFileReader.js:25:27)
    at NodeFileReader.getBytesAt (~/node_modules/jsmediatags/build2/MediaFileReader.js:70:23)
    at NodeFileReader.getStringWithCharsetAt (~/node_modules/jsmediatags/build2/MediaFileReader.js:154:22)
    at readPictureFrame (~/node_modules/jsmediatags/build2/ID3v2FrameReader.js:37:25)
    at ID3v2TagReader._readFrames (~/node_modules/jsmediatags/build2/ID3v2TagReader.js:151:40)
    at ID3v2TagReader._parseData (~/node_modules/jsmediatags/build2/ID3v2TagReader.js:74:25)
    at self._loadData.onSuccess (~/node_modules/jsmediatags/build2/MediaTagReader.js:43:29)
    at processData (~/node_modules/jsmediatags/build2/NodeFileReader.js:83:7)

Is this my inexperience or an error with this library?

aadsm commented 8 years ago

This is definitely a bug in the library. Hopefully it's the same issue that @conceptualspace reported. Not sure when I can debug it though.

tom-sherman commented 8 years ago

@aadsm is it possible to catch this error and exit gracefully?