Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-id3

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-id3 - npm Package Compare versions

Comparing version 0.1.13 to 0.1.14

index.d.ts

13

example/test.js

@@ -26,6 +26,13 @@ const nodeID3 = require('../index.js')

value: "ja moin3."
}],
private: [{
ownerIdentifier: "AbC",
data: "asdoahwdiohawdaw"
}, {
ownerIdentifier: "AbCSSS",
data: Buffer.from([0x01, 0x02, 0x05])
}]
}
let success = nodeID3.write(tags, "./example/example.mp3");
let success = nodeID3.write(tags, "./example/test.mp3");
console.log(success);

@@ -76,3 +83,3 @@

nodeID3.update({
/*nodeID3.update({
TXXX: [{

@@ -87,3 +94,3 @@ description: "testtt.",

console.log(nodeID3.read("./example/example.mp3"))
})
})*/

@@ -90,0 +97,0 @@ /*console.log(nodeID3.update({

@@ -127,2 +127,8 @@ const fs = require('fs')

name: "POPM"
},
private: {
create: "createPrivateFrame",
read: "readPrivateFrame",
name: "PRIV",
multiple: true
}

@@ -1055,3 +1061,3 @@ }

counterBuffer.writeUInt32BE(counter, 0)
buffer.writeUInt32BE(emailBuffer.length + ratingBuffer.length + counterBuffer.length, 4)

@@ -1080,3 +1086,5 @@ var frame = Buffer.concat([buffer, emailBuffer, ratingBuffer, counterBuffer])

let value = frame.slice(counterIndex, frame.length)
tags.counter = value.readUInt32BE()
if(value.length >= 4) {
tags.counter = value.readUInt32BE()
}
}

@@ -1086,2 +1094,67 @@ }

return tags
}
/*
** private => object|array {
** ownerIdentifier: string,
** data: buffer|string
** }
**/
NodeID3.prototype.createPrivateFrame = function(private) {
if(private instanceof Array && private.length > 0) {
let frames = []
private.forEach(tag => {
let frame = createPrivateFrameHelper(tag)
if(frame) {
frames.push(frame)
}
})
return frames.length ? Buffer.concat(frames) : null
} else {
return createPrivateFrameHelper(private)
}
}
function createPrivateFrameHelper(private) {
if(!private || !private.ownerIdentifier || !private.data) {
return null;
}
let header = Buffer.alloc(10, 0)
header.write("PRIV")
let ownerIdentifier = Buffer.from(private.ownerIdentifier + "\0", "utf8")
let data
if(typeof(private.data) == "string") {
data = Buffer.from(private.data, "utf8")
} else {
data = private.data
}
header.writeUInt32BE(ownerIdentifier.length + data.length, 4)
return Buffer.concat([header, ownerIdentifier, data])
}
/*
** frame => Buffer
*/
NodeID3.prototype.readPrivateFrame = function(frame) {
let tags = {}
if(!frame) {
return tags
}
let endOfOwnerIdentification = frame.indexOf(0x00)
if(endOfOwnerIdentification == -1) {
return tags
}
tags.ownerIdentifier = iconv.decode(frame.slice(0, endOfOwnerIdentification), "ISO-8859-1")
if(frame.length <= endOfOwnerIdentification + 1) {
return tags
}
tags.data = frame.slice(endOfOwnerIdentification + 1)
return tags
}
{
"name": "node-id3",
"version": "0.1.13",
"version": "0.1.14",
"description": "Pure JavaScript ID3 Tag writer/reader",

@@ -5,0 +5,0 @@ "author": "Jan Metzger <jan.metzger@gmx.net>",

@@ -150,3 +150,15 @@ # node-id3

imageBuffer: (file buffer)
}
},
popularimeter: {
email: "mail@example.com",
rating: 192, // 1-255
counter: 12
},
private: [{
ownerIdentifier: "AbC",
data: "asdoahwdiohawdaw"
}, {
ownerIdentifier: "AbCSSS",
data: Buffer.from([0x01, 0x02, 0x05])
}]
```

@@ -199,2 +211,4 @@

userDefinedText "TXXX"
popularimeter "POPM"
private "PRIV"
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc