UNPKG

2.7 kBJavaScriptView Raw
1const nodeID3 = require('../index.js')
2const fs = require('fs')
3
4
5//tags.image is the path to the image (only png/jpeg files allowed)
6const tags = {
7 title: "Tomorrow",
8 artist: "Kevin Penkin",
9 album: "asdfd",
10 APIC: "./example/mia_cover.jpg",
11 year: 2017,
12 comment: {
13 language: "eng",
14 text: "some text"
15 },
16 TRCK: "27",
17 TXXX: [{
18 description: "testtt.",
19 value: "ja moin."
20 }, {
21 description: "testtt2.",
22 value: "ja moin2."
23 }, {
24 description: "testtt3.",
25 value: "ja moin3."
26 }],
27 private: [{
28 ownerIdentifier: "AbC",
29 data: "asdoahwdiohawdaw"
30 }, {
31 ownerIdentifier: "AbCSSS",
32 data: Buffer.from([0x01, 0x02, 0x05])
33 }],
34 chapter: [{
35 elementID: "Hey!",
36 startTimeMs: 5000,
37 endTimeMs: 8000,
38 tags: {
39 title: "abcdef",
40 artist: "akshdas"
41 }
42 }, {
43 elementID: "Hey2!",
44 startTimeMs: 225000,
45 endTimeMs: 8465000,
46 tags: {
47 artist: "abcdef222"
48 }
49 }]
50}
51
52let success = nodeID3.write(tags, "./example/test.mp3");
53console.log(success);
54
55console.log(nodeID3.read("./example/test.mp3").chapter[0].tags)
56
57/*nodeID3.create(tags, function(frame) {
58 console.log(frame)
59})*/
60
61//let file = fs.readFileSync("./example/Kevin Penkin - Tomorrow.mp3")
62/*nodeID3.update(tags, file, function(err, buffer) {
63 console.log(err)
64 console.log(buffer)
65})*/
66
67//fs.writeFileSync("./example/Kevin Penkin - Tomorrow.mp3", nodeID3.update(tags, file))
68
69//console.log(nodeID3.read("./example/example.mp3"))
70
71//async
72
73/*nodeID3.write(tags, "./example/Kevin Penkin - Tomorrow.mp3", function(err) {
74 console.log(err)
75})
76*/
77
78//console.log(nodeID3.read("./example/Kevin Penkin - Tomorrow.mp3"))
79
80
81/*console.log("READING\n\n")
82nodeID3.read("./example/Kevin Penkin - Tomorrow.mp3", function(err, tags) {
83 console.log(err)
84 console.log(tags)
85
86 console.log("REMOVING\n\n")
87 nodeID3.removeTags("./example/Kevin Penkin - Tomorrow.mp3", function(err) {
88 console.log("READING\n\n")
89 nodeID3.read("./example/Kevin Penkin - Tomorrow.mp3", function(err, tags) {
90 console.log(err)
91 console.log(tags)
92 })
93 })
94
95})
96*/
97
98/*nodeID3.update({
99 TXXX: [{
100 description: "testtt.",
101 value: "value4."
102 }, {
103 description: "testtt2.",
104 value: "value6."
105 },]
106}, "./example/example.mp3", (err) => {
107 console.log(nodeID3.read("./example/example.mp3"))
108})*/
109
110/*console.log(nodeID3.update({
111 TXXX: [{
112 description: "testtt.",
113 value: "value4."
114 }, {
115 description: "testtt2.",
116 value: "value6."
117 },]
118}, "./example/example.mp3"));
119
120console.log(nodeID3.read("./example/example.mp3"))*/
\No newline at end of file