music-metadata 9.0.1 → 9.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -53,14 +53,14 @@ Primarily designed for [Node.js](https://nodejs.org/), but has also been designe
53
53
  ### Supported tag headers
54
54
 
55
55
  Following tag header formats are supported:
56
- * [APE](https://wikipedia.org/wiki/APE_tag)
57
- * [ASF](https://wikipedia.org/wiki/Advanced_Systems_Format)
58
- * EXIF 2.3
59
- * [ID3](https://wikipedia.org/wiki/ID3): ID3v1, ID3v1.1, ID3v2.2, [ID3v2.3](http://id3.org/id3v2.3.0) & [ID3v2.4](http://id3.org/id3v2.4.0-frames)
60
- * [iTunes](https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata)
61
- * [RIFF](https://wikipedia.org/wiki/Resource_Interchange_File_Format)/INFO
62
- * [Vorbis comment](https://wikipedia.org/wiki/Vorbis_comment)
63
- * [AIFF](https://wikipedia.org/wiki/Audio_Interchange_File_Format)
56
+ - [APE](https://wikipedia.org/wiki/APE_tag)
57
+ - [ASF](https://wikipedia.org/wiki/Advanced_Systems_Format)
58
+ - EXIF 2.3
59
+ - [ID3](https://wikipedia.org/wiki/ID3): ID3v1, ID3v1.1, ID3v2.2, [ID3v2.3](http://id3.org/id3v2.3.0) & [ID3v2.4](http://id3.org/id3v2.4.0-frames)
60
+ - [iTunes](https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata)
61
+ - [RIFF](https://wikipedia.org/wiki/Resource_Interchange_File_Format)/INFO
62
+ - [Vorbis comment](https://wikipedia.org/wiki/Vorbis_comment)
63
+ - [AIFF](https://wikipedia.org/wiki/Audio_Interchange_File_Format)
64
64
 
65
65
  It allows many tags to be accessed in audio format, and tag format independent way.
66
66
 
@@ -70,15 +70,15 @@ Support for [MusicBrainz](https://musicbrainz.org/) tags as written by [Picard](
70
70
  ### Audio format & encoding details
71
71
 
72
72
  Support for encoding / format details:
73
- * [Bit rate](https://wikipedia.org/wiki/Bit_rate)
74
- * [Audio bit depth](https://wikipedia.org/wiki/Audio_bit_depth)
75
- * Duration
76
- * Encoding profile (e.g. [CBR](https://en.wikipedia.org/wiki/Constant_bitrate), V0, V2)
73
+ - [Bit rate](https://wikipedia.org/wiki/Bit_rate)
74
+ - [Audio bit depth](https://wikipedia.org/wiki/Audio_bit_depth)
75
+ - Duration
76
+ - Encoding profile (e.g. [CBR](https://en.wikipedia.org/wiki/Constant_bitrate), V0, V2)
77
77
 
78
78
 
79
79
  ## Online demo's
80
- * [<img src="https://raw.githubusercontent.com/Borewit/audio-tag-analyzer/master/src/assets/icon/audio-tag-analyzer.svg" width="40">Audio Tag Analyzer](https://audio-tag-analyzer.netlify.app/)
81
- * [<img src="https://cdn.sanity.io/images/3do82whm/next/ba8c847f13a5fa39d88f8bc9b7846b7886531b18-2500x2500.svg" width="40"> Webamp](https://webamp.org/)
80
+ - [<img src="https://raw.githubusercontent.com/Borewit/audio-tag-analyzer/master/src/assets/icon/audio-tag-analyzer.svg" width="40">Audio Tag Analyzer](https://audio-tag-analyzer.netlify.app/)
81
+ - [<img src="https://cdn.sanity.io/images/3do82whm/next/ba8c847f13a5fa39d88f8bc9b7846b7886531b18-2500x2500.svg" width="40"> Webamp](https://webamp.org/)
82
82
 
83
83
 
84
84
  ### Sponsor
@@ -114,13 +114,13 @@ graph TD;
114
114
  ```
115
115
 
116
116
  Dependency list:
117
- * [tokenizer-token](https://github.com/Borewit/tokenizer-token)
118
- * [strtok3](https://github.com/Borewit/strtok3)
119
- * [token-types](https://github.com/Borewit/token-types)
120
- * [file-type](https://github.com/sindresorhus/file-type)
121
- * [@tokenizer-token](https://github.com/Borewit/tokenizer-token)
122
- * [peek-readable](https://github.com/Borewit/peek-readable)
123
- * [readable-web-to-node-stream](https://github.com/Borewit/readable-web-to-node-stream)
117
+ - [tokenizer-token](https://github.com/Borewit/tokenizer-token)
118
+ - [strtok3](https://github.com/Borewit/strtok3)
119
+ - [token-types](https://github.com/Borewit/token-types)
120
+ - [file-type](https://github.com/sindresorhus/file-type)
121
+ - [@tokenizer-token](https://github.com/Borewit/tokenizer-token)
122
+ - [peek-readable](https://github.com/Borewit/peek-readable)
123
+ - [readable-web-to-node-stream](https://github.com/Borewit/readable-web-to-node-stream)
124
124
 
125
125
  ## Usage
126
126
 
@@ -273,7 +273,7 @@ This is a low level function, reading from a [strtok3](https://github.com/Borewi
273
273
  [music-metadata-browser](https://github.com/Borewit/music-metadata-browser) is depended on this function.
274
274
 
275
275
  This also enables special read modules like:
276
- * [streaming-http-token-reader](https://github.com/Borewit/streaming-http-token-reader) for chunked HTTP(S) reading, using [HTTP range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests).
276
+ - [streaming-http-token-reader](https://github.com/Borewit/streaming-http-token-reader) for chunked HTTP(S) reading, using [HTTP range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests).
277
277
 
278
278
  #### orderTags function
279
279
 
package/lib/core.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Primary entry point, Node.js specific entry point is index.ts
3
+ */
1
4
  import * as strtok3 from 'strtok3';
2
5
  import type { IAudioMetadata, INativeTagDict, IOptions, IPicture, IPrivateOptions, IRandomReader, ITag } from './type.js';
3
6
  import type { ReadableStream as NodeReadableStream } from 'node:stream/web';
@@ -43,7 +46,7 @@ export declare function parseFromTokenizer(tokenizer: strtok3.ITokenizer, option
43
46
  export declare function orderTags(nativeTags: ITag[]): INativeTagDict;
44
47
  /**
45
48
  * Convert rating to 1-5 star rating
46
- * @param rating: Normalized rating [0..1] (common.rating[n].rating)
49
+ * @param rating Normalized rating [0..1] (common.rating[n].rating)
47
50
  * @returns Number of stars: 1, 2, 3, 4 or 5 stars
48
51
  */
49
52
  export declare function ratingToStars(rating: number): number;
package/lib/core.js CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Primary entry point, Node.js specific entry point is index.ts
3
+ */
1
4
  import * as strtok3 from 'strtok3';
2
5
  import { ParserFactory } from './ParserFactory.js';
3
6
  import { RandomUint8ArrayReader } from './common/RandomUint8ArrayReader.js';
@@ -26,7 +29,7 @@ export async function parseBlob(blob, options = {}) {
26
29
  * @returns Metadata
27
30
  */
28
31
  export function parseWebStream(webStream, fileInfo, options = {}) {
29
- return parseFromTokenizer(strtok3.fromWebStream(webStream, typeof fileInfo === 'string' ? { mimeType: fileInfo } : fileInfo), options);
32
+ return parseFromTokenizer(strtok3.fromWebStream(webStream, { fileInfo: typeof fileInfo === 'string' ? { mimeType: fileInfo } : fileInfo }), options);
30
33
  }
31
34
  /**
32
35
  * Parse audio from Node Buffer
@@ -39,7 +42,7 @@ export function parseWebStream(webStream, fileInfo, options = {}) {
39
42
  export async function parseBuffer(uint8Array, fileInfo, options = {}) {
40
43
  const bufferReader = new RandomUint8ArrayReader(uint8Array);
41
44
  await scanAppendingHeaders(bufferReader, options);
42
- const tokenizer = strtok3.fromBuffer(uint8Array, typeof fileInfo === 'string' ? { mimeType: fileInfo } : fileInfo);
45
+ const tokenizer = strtok3.fromBuffer(uint8Array, { fileInfo: typeof fileInfo === 'string' ? { mimeType: fileInfo } : fileInfo });
43
46
  return parseFromTokenizer(tokenizer, options);
44
47
  }
45
48
  /**
@@ -65,7 +68,7 @@ export function orderTags(nativeTags) {
65
68
  }
66
69
  /**
67
70
  * Convert rating to 1-5 star rating
68
- * @param rating: Normalized rating [0..1] (common.rating[n].rating)
71
+ * @param rating Normalized rating [0..1] (common.rating[n].rating)
69
72
  * @returns Number of stars: 1, 2, 3, 4 or 5 stars
70
73
  */
71
74
  export function ratingToStars(rating) {
package/lib/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
+ /**
2
+ * Node.js specific entry point.
3
+ */
1
4
  import * as Stream from 'stream';
2
5
  import * as strtok3 from 'strtok3';
3
6
  import { IAudioMetadata, IOptions } from './type.js';
4
7
  export { IAudioMetadata, IOptions, ITag, INativeTagDict, ICommonTagsResult, IFormat, IPicture, IRatio, IChapter } from './type.js';
5
- export { parseFromTokenizer, parseBuffer, parseBlob, selectCover, orderTags, ratingToStars, IFileInfo } from './core.js';
8
+ export { parseFromTokenizer, parseBuffer, parseBlob, parseWebStream, selectCover, orderTags, ratingToStars, IFileInfo } from './core.js';
6
9
  /**
7
10
  * Parse audio from Node Stream.Readable
8
11
  * @param stream - Stream to read the audio track from
package/lib/index.js CHANGED
@@ -1,9 +1,12 @@
1
+ /**
2
+ * Node.js specific entry point.
3
+ */
1
4
  import * as strtok3 from 'strtok3';
2
5
  import initDebug from 'debug';
3
6
  import { parseFromTokenizer, scanAppendingHeaders } from './core.js';
4
7
  import { ParserFactory } from './ParserFactory.js';
5
8
  import { RandomFileReader } from './common/RandomFileReader.js';
6
- export { parseFromTokenizer, parseBuffer, parseBlob, selectCover, orderTags, ratingToStars } from './core.js';
9
+ export { parseFromTokenizer, parseBuffer, parseBlob, parseWebStream, selectCover, orderTags, ratingToStars } from './core.js';
7
10
  const debug = initDebug('music-metadata:parser');
8
11
  /**
9
12
  * Parse audio from Node Stream.Readable
@@ -13,7 +16,7 @@ const debug = initDebug('music-metadata:parser');
13
16
  * @returns Metadata
14
17
  */
15
18
  export async function parseStream(stream, fileInfo, options = {}) {
16
- const tokenizer = await strtok3.fromStream(stream, typeof fileInfo === 'string' ? { mimeType: fileInfo } : fileInfo);
19
+ const tokenizer = await strtok3.fromStream(stream, { fileInfo: typeof fileInfo === 'string' ? { mimeType: fileInfo } : fileInfo });
17
20
  return parseFromTokenizer(tokenizer, options);
18
21
  }
19
22
  /**
package/package.json CHANGED
@@ -1,15 +1,21 @@
1
1
  {
2
2
  "name": "music-metadata",
3
3
  "description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
4
- "version": "9.0.1",
4
+ "version": "9.0.2",
5
5
  "author": {
6
6
  "name": "Borewit",
7
7
  "url": "https://github.com/Borewit"
8
8
  },
9
- "funding": {
10
- "type": "github",
11
- "url": "https://github.com/sponsors/Borewit"
12
- },
9
+ "funding": [
10
+ {
11
+ "type": "github",
12
+ "url": "https://github.com/sponsors/Borewit"
13
+ },
14
+ {
15
+ "type": "buymeacoffee",
16
+ "url": "https://buymeacoffee.com/borewit"
17
+ }
18
+ ],
13
19
  "type": "module",
14
20
  "exports": {
15
21
  ".": {
@@ -73,12 +79,12 @@
73
79
  "bwf"
74
80
  ],
75
81
  "scripts": {
76
- "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts src/**/*.d.ts test/**/*.js test/**/*.js.map test/**/*.js test/**/*.js.map doc-gen/**/*.js doc-gen/**/*.js.map",
82
+ "clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'src/**/*.d.ts' 'test/**/*.js' 'test/**/*.js.map' 'test/**/*.js' 'test/**/*.js.map' 'doc-gen/**/*.js' 'doc-gen/**/*.js.map'",
77
83
  "compile-src": "tsc -p lib",
78
84
  "compile-test": "tsc -p test",
79
85
  "compile-doc": "tsc -p doc-gen",
80
86
  "compile": "npm run compile-src && npm run compile-test && npm run compile-doc",
81
- "eslint": "npx eslint lib/**/*.ts --ignore-pattern lib/**/*.d.ts example/typescript/**/*.ts test/**/*.ts doc-gen/**/*.ts",
87
+ "eslint": "eslint lib/**/*.ts --ignore-pattern lib/**/*.d.ts example/typescript/**/*.ts test/**/*.ts doc-gen/**/*.ts",
82
88
  "lint-md": "remark -u preset-lint-markdown-style-guide .",
83
89
  "lint": "npm run lint-md && npm run eslint",
84
90
  "test": "mocha",
@@ -92,11 +98,11 @@
92
98
  "@tokenizer/token": "^0.3.0",
93
99
  "content-type": "^1.0.5",
94
100
  "debug": "^4.3.4",
95
- "file-type": "^19.1.1",
101
+ "file-type": "^19.2.0",
96
102
  "media-typer": "^1.1.0",
97
- "strtok3": "^7.1.0",
103
+ "strtok3": "^8.0.0",
98
104
  "token-types": "^6.0.0",
99
- "uint8array-extras": "^1.3.0"
105
+ "uint8array-extras": "^1.4.0"
100
106
  },
101
107
  "devDependencies": {
102
108
  "@types/chai": "^4.3.16",
@@ -104,7 +110,7 @@
104
110
  "@types/debug": "^4.1.12",
105
111
  "@types/file-type": "^10.9.1",
106
112
  "@types/mocha": "^10.0.7",
107
- "@types/node": "^20.14.10",
113
+ "@types/node": "^20.14.11",
108
114
  "@typescript-eslint/eslint-plugin": "^7.16.0",
109
115
  "@typescript-eslint/parser": "^7.16.0",
110
116
  "c8": "^10.1.2",
@@ -121,7 +127,7 @@
121
127
  "mime": "^4.0.4",
122
128
  "mocha": "^10.6.0",
123
129
  "npm-run-all": "^4.1.5",
124
- "prettier": "^3.3.2",
130
+ "prettier": "^3.3.3",
125
131
  "remark-cli": "^12.0.1",
126
132
  "remark-preset-lint-markdown-style-guide": "^6.0.0",
127
133
  "ts-node": "^10.9.2",
@@ -137,5 +143,6 @@
137
143
  "license": "MIT",
138
144
  "bugs": {
139
145
  "url": "https://github.com/Borewit/music-metadata/issues"
140
- }
146
+ },
147
+ "packageManager": "yarn@4.3.1"
141
148
  }