Comments (4)
@dvdcxn v1.2
has fixed this, and you can always check stats.version
to determine whether the id3 parse worked.
-
If invalid argument passed, the promise rejected.
-
If the buffer is not valid
id3v1
orid3v2
buffer, you get{version: false}
. -
Otherwise, you get
{ version: { v1: false | object, v2: false | object } }
Enjoy the new version.
from id3-parser.
@dvdcxn I think there is no need to change id3-parser
's behavior.
You could wrap the lib yourself, such as code below:
function analyseFile(fileName) {
let _readFile = bluebird.promisify(readFile);
let content;
return _readFile(fileName)
.then(buf => {
content = buf;
return buf;
})
.then(id3.parse)
.then(stats => {
if(stats.version){
return stats;
}
else{
throw `Couldn\'t determine id3 data for file ${fileName}`;
}
})
.catch(err => {
return content;
});
}
from id3-parser.
@creeperyang Will do. Is checking whether the version is truthy a reliable enough way to determine whether the id3 parse worked?
from id3-parser.
No. If the buffer's length is less than required, false
is returned.
// use this instead
if (stats && stats.version) {}
Good question! I should make the promise rejected when the buffer is less than expected.
from id3-parser.
Related Issues (17)
- calcFrameSize returning NaN HOT 3
- Handling of null-terminated strings HOT 5
- Support chapter frames? HOT 1
- Tag doesn't parse. HOT 3
- id3-parser v2
- A possible bug about APIC frame HOT 1
- Readme provides no example for usage on local files
- {'user-defined-text-information': '哾愀最最椀渀最 琀椀洀攀',} looks incorrectly parsed. HOT 1
- Need Support for AngularJS/Javascript Plain HOT 1
- Thanks for this library HOT 2
- It's entirely written in TypeScript HOT 2
- TXXX type metadata added to ID3.4 by ffmpeg cannot be parsed
- 可以增加对flac的解析吗
- what would be involved in implementing unsync support?
- Memory gobbled when using a buffer as input HOT 2
- Type Definition File HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from id3-parser.