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.5 to 0.1.6

22

example/test.js

@@ -1,7 +0,19 @@

const nodeID3 = require('../index.js')
const NodeID3 = require('../index.js')
const fs = require('fs')
const file = './example/test3.mp3'
const buf = fs.readFileSync(file)
try {
let tags = NodeID3.read(file)
console.log(tags)
fs.writeFileSync('./example/test.jpg', tags.image.imageBuffer)
} catch (err) {
console.log(err)
}
//tags.image is the path to the image (only png/jpeg files allowed)
const tags = {
/*const tags = {
title: "Tomorrow",

@@ -17,3 +29,3 @@ artist: "Kevin Penkin",

TRCK: "27"
}
}*/

@@ -29,3 +41,3 @@ /*let success = nodeID3.write(tags, "./example/Kevin Penkin - Tomorrow.mp3");

let file = fs.readFileSync("./example/Kevin Penkin - Tomorrow.mp3")
//let file = fs.readFileSync("./example/Kevin Penkin - Tomorrow.mp3")
/*nodeID3.update(tags, file, function(err, buffer) {

@@ -36,3 +48,3 @@ console.log(err)

fs.writeFileSync("./example/Kevin Penkin - Tomorrow.mp3", nodeID3.update(tags, file))
//fs.writeFileSync("./example/Kevin Penkin - Tomorrow.mp3", nodeID3.update(tags, file))

@@ -39,0 +51,0 @@ //console.log(nodeID3.read("./example/Kevin Penkin - Tomorrow.mp3"))

@@ -304,3 +304,3 @@ const fs = require('fs')

}
let frameSize = this.getFrameSize(new Buffer(filebuffer.toString('hex', framePosition, framePosition + 10), "hex"), true) + 10
let frameSize = this.getTagSize(new Buffer(filebuffer.toString('hex', framePosition, framePosition + 10), "hex")) + 10
let ID3Frame = new Buffer(frameSize + 1)

@@ -311,2 +311,5 @@ let ID3FrameBody = new Buffer(frameSize - 10 + 1)

//ID3 version e.g. 3 if ID3v2.3.0
let ID3Version = ID3Frame[3]
// Now, get frame for frame by given size to support unkown tags etc.

@@ -319,3 +322,8 @@ let frames = []

ID3FrameBody.copy(bodyFrameHeader, 0, currentPosition)
let bodyFrameSize = this.getFrameSize(bodyFrameHeader).readUIntBE(0, 4)
let decodeSize = false
if(ID3Version == 4) {
decodeSize = true
}
let bodyFrameSize = this.getFrameSize(bodyFrameHeader, decodeSize)
let bodyFrameBuffer = new Buffer(bodyFrameSize)

@@ -376,2 +384,10 @@ ID3FrameBody.copy(bodyFrameBuffer, 0, currentPosition + 10)

/*
** Get size of tag from header
** buffer => Buffer/Array (header)
*/
NodeID3.prototype.getTagSize = function(buffer) {
return this.decodeSize(new Buffer([buffer[6], buffer[7], buffer[8], buffer[9]]))
}
/*
** Get size of frame from header

@@ -383,5 +399,5 @@ ** buffer => Buffer/Array (header)

if(decode) {
return this.decodeSize(new Buffer([buffer[6], buffer[7], buffer[8], buffer[9]]))
return this.decodeSize(new Buffer([buffer[4], buffer[5], buffer[6], buffer[7]]))
} else {
return new Buffer([buffer[4], buffer[5], buffer[6], buffer[7]])
return (new Buffer([buffer[4], buffer[5], buffer[6], buffer[7]])).readUIntBE(0, 4)
}

@@ -388,0 +404,0 @@ }

{
"name": "node-id3",
"version": "0.1.5",
"version": "0.1.6",
"description": "Pure JavaScript ID3 Tag writer/reader",

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

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