@dragon708/docmind-markdown 1.2.5 → 1.2.7
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/node_modules/music-metadata/LICENSE.txt +3 -3
- package/node_modules/music-metadata/README.md +246 -690
- package/node_modules/music-metadata/lib/ParserFactory.d.ts +31 -27
- package/node_modules/music-metadata/lib/ParserFactory.js +219 -108
- package/node_modules/music-metadata/lib/aiff/AiffParser.d.ts +2 -2
- package/node_modules/music-metadata/lib/aiff/AiffParser.js +38 -34
- package/node_modules/music-metadata/lib/aiff/AiffTagMap.d.ts +1 -1
- package/node_modules/music-metadata/lib/aiff/AiffTagMap.js +7 -2
- package/node_modules/music-metadata/lib/aiff/AiffToken.d.ts +6 -32
- package/node_modules/music-metadata/lib/aiff/AiffToken.js +17 -27
- package/node_modules/music-metadata/lib/apev2/APEv2Parser.d.ts +8 -24
- package/node_modules/music-metadata/lib/apev2/APEv2Parser.js +66 -78
- package/node_modules/music-metadata/lib/apev2/APEv2TagMapper.d.ts +1 -1
- package/node_modules/music-metadata/lib/apev2/APEv2TagMapper.js +8 -4
- package/node_modules/music-metadata/lib/apev2/APEv2Token.d.ts +11 -10
- package/node_modules/music-metadata/lib/apev2/APEv2Token.js +27 -16
- package/node_modules/music-metadata/lib/asf/AsfObject.d.ts +53 -59
- package/node_modules/music-metadata/lib/asf/AsfObject.js +131 -97
- package/node_modules/music-metadata/lib/asf/AsfParser.d.ts +1 -1
- package/node_modules/music-metadata/lib/asf/AsfParser.js +43 -42
- package/node_modules/music-metadata/lib/asf/AsfTagMapper.d.ts +2 -2
- package/node_modules/music-metadata/lib/asf/AsfTagMapper.js +10 -6
- package/node_modules/music-metadata/lib/asf/AsfUtil.d.ts +13 -4
- package/node_modules/music-metadata/lib/asf/AsfUtil.js +36 -30
- package/node_modules/music-metadata/lib/asf/GUID.d.ts +84 -0
- package/node_modules/music-metadata/lib/asf/GUID.js +121 -0
- package/node_modules/music-metadata/lib/common/BasicParser.d.ts +9 -9
- package/node_modules/music-metadata/lib/common/BasicParser.js +7 -2
- package/node_modules/music-metadata/lib/common/CaseInsensitiveTagMap.d.ts +3 -3
- package/node_modules/music-metadata/lib/common/CaseInsensitiveTagMap.js +7 -2
- package/node_modules/music-metadata/lib/common/CombinedTagMapper.d.ts +5 -5
- package/node_modules/music-metadata/lib/common/CombinedTagMapper.js +28 -24
- package/node_modules/music-metadata/lib/common/FourCC.d.ts +1 -1
- package/node_modules/music-metadata/lib/common/FourCC.js +11 -10
- package/node_modules/music-metadata/lib/common/GenericTagMapper.d.ts +13 -13
- package/node_modules/music-metadata/lib/common/GenericTagMapper.js +12 -7
- package/node_modules/music-metadata/lib/common/GenericTagTypes.d.ts +6 -7
- package/node_modules/music-metadata/lib/common/GenericTagTypes.js +85 -86
- package/node_modules/music-metadata/lib/common/MetadataCollector.d.ts +10 -20
- package/node_modules/music-metadata/lib/common/MetadataCollector.js +69 -100
- package/node_modules/music-metadata/lib/common/RandomFileReader.d.ts +22 -0
- package/node_modules/music-metadata/lib/common/RandomFileReader.js +34 -0
- package/node_modules/music-metadata/lib/common/RandomUint8ArrayReader.d.ts +18 -0
- package/node_modules/music-metadata/lib/common/RandomUint8ArrayReader.js +25 -0
- package/node_modules/music-metadata/lib/common/Util.d.ts +12 -11
- package/node_modules/music-metadata/lib/common/Util.js +53 -47
- package/node_modules/music-metadata/lib/core.d.ts +15 -42
- package/node_modules/music-metadata/lib/core.js +38 -74
- package/node_modules/music-metadata/lib/dsdiff/DsdiffParser.d.ts +1 -16
- package/node_modules/music-metadata/lib/dsdiff/DsdiffParser.js +44 -55
- package/node_modules/music-metadata/lib/dsdiff/DsdiffToken.d.ts +3 -3
- package/node_modules/music-metadata/lib/dsdiff/DsdiffToken.js +7 -4
- package/node_modules/music-metadata/lib/dsf/DsfChunk.d.ts +10 -11
- package/node_modules/music-metadata/lib/dsf/DsfChunk.js +19 -15
- package/node_modules/music-metadata/lib/dsf/DsfParser.d.ts +1 -16
- package/node_modules/music-metadata/lib/dsf/DsfParser.js +20 -21
- package/node_modules/music-metadata/lib/flac/FlacParser.d.ts +15 -16
- package/node_modules/music-metadata/lib/flac/FlacParser.js +119 -69
- package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.d.ts +3 -7
- package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +36 -39
- package/node_modules/music-metadata/lib/id3v1/ID3v1TagMap.d.ts +1 -1
- package/node_modules/music-metadata/lib/id3v1/ID3v1TagMap.js +7 -2
- package/node_modules/music-metadata/lib/id3v2/AbstractID3Parser.d.ts +2 -2
- package/node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js +19 -15
- package/node_modules/music-metadata/lib/id3v2/FrameParser.d.ts +3 -64
- package/node_modules/music-metadata/lib/id3v2/FrameParser.js +103 -244
- package/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.d.ts +2 -2
- package/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.js +16 -6
- package/node_modules/music-metadata/lib/id3v2/ID3v24TagMapper.d.ts +5 -5
- package/node_modules/music-metadata/lib/id3v2/ID3v24TagMapper.js +35 -36
- package/node_modules/music-metadata/lib/id3v2/ID3v2Parser.d.ts +6 -11
- package/node_modules/music-metadata/lib/id3v2/ID3v2Parser.js +104 -91
- package/node_modules/music-metadata/lib/id3v2/ID3v2Token.d.ts +29 -67
- package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +36 -76
- package/node_modules/music-metadata/lib/iff/index.d.ts +1 -1
- package/node_modules/music-metadata/lib/iff/index.js +7 -4
- package/node_modules/music-metadata/lib/index.d.ts +31 -8
- package/node_modules/music-metadata/lib/index.js +53 -32
- package/node_modules/music-metadata/lib/lyrics3/Lyrics3.d.ts +2 -2
- package/node_modules/music-metadata/lib/lyrics3/Lyrics3.js +13 -13
- package/node_modules/music-metadata/lib/matroska/MatroskaDtd.d.ts +2 -2
- package/node_modules/music-metadata/lib/matroska/MatroskaDtd.js +242 -246
- package/node_modules/music-metadata/lib/matroska/MatroskaParser.d.ts +24 -6
- package/node_modules/music-metadata/lib/matroska/MatroskaParser.js +218 -124
- package/node_modules/music-metadata/lib/matroska/MatroskaTagMapper.d.ts +1 -1
- package/node_modules/music-metadata/lib/matroska/MatroskaTagMapper.js +7 -3
- package/node_modules/music-metadata/lib/matroska/types.d.ts +76 -43
- package/node_modules/music-metadata/lib/matroska/types.js +33 -27
- package/node_modules/music-metadata/lib/mp4/Atom.d.ts +7 -7
- package/node_modules/music-metadata/lib/mp4/Atom.js +22 -15
- package/node_modules/music-metadata/lib/mp4/AtomToken.d.ts +18 -110
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +66 -184
- package/node_modules/music-metadata/lib/mp4/MP4Parser.d.ts +4 -6
- package/node_modules/music-metadata/lib/mp4/MP4Parser.js +128 -255
- package/node_modules/music-metadata/lib/mp4/MP4TagMapper.d.ts +4 -4
- package/node_modules/music-metadata/lib/mp4/MP4TagMapper.js +12 -8
- package/node_modules/music-metadata/lib/mpeg/ExtendedLameHeader.d.ts +5 -5
- package/node_modules/music-metadata/lib/mpeg/ExtendedLameHeader.js +10 -7
- package/node_modules/music-metadata/lib/mpeg/MpegParser.d.ts +4 -17
- package/node_modules/music-metadata/lib/mpeg/MpegParser.js +131 -176
- package/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.d.ts +14 -16
- package/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.js +19 -14
- package/node_modules/music-metadata/lib/mpeg/XingTag.d.ts +7 -6
- package/node_modules/music-metadata/lib/mpeg/XingTag.js +18 -14
- package/node_modules/music-metadata/lib/musepack/index.d.ts +5 -0
- package/node_modules/music-metadata/lib/musepack/index.js +32 -0
- package/node_modules/music-metadata/lib/musepack/sv7/BitReader.d.ts +2 -2
- package/node_modules/music-metadata/lib/musepack/sv7/BitReader.js +24 -16
- package/node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.d.ts +1 -1
- package/node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.js +15 -16
- package/node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.d.ts +1 -1
- package/node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.js +7 -5
- package/node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.d.ts +1 -1
- package/node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.js +17 -18
- package/node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.d.ts +3 -5
- package/node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.js +12 -14
- package/node_modules/music-metadata/lib/ogg/{OggToken.d.ts → Ogg.d.ts} +6 -17
- package/node_modules/music-metadata/lib/ogg/Ogg.js +2 -0
- package/node_modules/music-metadata/lib/ogg/OggParser.d.ts +12 -16
- package/node_modules/music-metadata/lib/ogg/OggParser.js +102 -101
- package/node_modules/music-metadata/lib/ogg/opus/Opus.d.ts +2 -17
- package/node_modules/music-metadata/lib/ogg/opus/Opus.js +14 -13
- package/node_modules/music-metadata/lib/ogg/opus/OpusParser.d.ts +25 -0
- package/node_modules/music-metadata/lib/ogg/opus/{OpusStream.js → OpusParser.js} +18 -18
- package/node_modules/music-metadata/lib/ogg/speex/Speex.d.ts +1 -1
- package/node_modules/music-metadata/lib/ogg/speex/Speex.js +19 -16
- package/node_modules/music-metadata/lib/ogg/speex/SpeexParser.d.ts +22 -0
- package/node_modules/music-metadata/lib/ogg/speex/{SpeexStream.js → SpeexParser.js} +13 -9
- package/node_modules/music-metadata/lib/ogg/theora/Theora.d.ts +1 -1
- package/node_modules/music-metadata/lib/ogg/theora/Theora.js +11 -8
- package/node_modules/music-metadata/lib/ogg/theora/TheoraParser.d.ts +28 -0
- package/node_modules/music-metadata/lib/ogg/theora/TheoraParser.js +44 -0
- package/node_modules/music-metadata/lib/ogg/vorbis/Vorbis.d.ts +7 -6
- package/node_modules/music-metadata/lib/ogg/vorbis/Vorbis.js +29 -34
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisDecoder.d.ts +1 -1
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisDecoder.js +9 -6
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisParser.d.ts +36 -0
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisParser.js +128 -0
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisTagMapper.d.ts +3 -3
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisTagMapper.js +9 -5
- package/node_modules/music-metadata/lib/riff/RiffChunk.d.ts +5 -5
- package/node_modules/music-metadata/lib/riff/RiffChunk.js +9 -5
- package/node_modules/music-metadata/lib/riff/RiffInfoTagMap.d.ts +2 -2
- package/node_modules/music-metadata/lib/riff/RiffInfoTagMap.js +25 -20
- package/node_modules/music-metadata/lib/type.d.ts +52 -121
- package/node_modules/music-metadata/lib/type.js +6 -2
- package/node_modules/music-metadata/lib/wav/BwfChunk.d.ts +1 -1
- package/node_modules/music-metadata/lib/wav/BwfChunk.js +11 -8
- package/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +20 -50
- package/node_modules/music-metadata/lib/wav/WaveChunk.js +32 -45
- package/node_modules/music-metadata/lib/wav/WaveParser.d.ts +2 -2
- package/node_modules/music-metadata/lib/wav/WaveParser.js +39 -46
- package/node_modules/music-metadata/lib/wavpack/WavPackParser.d.ts +2 -18
- package/node_modules/music-metadata/lib/wavpack/WavPackParser.js +32 -42
- package/node_modules/music-metadata/lib/wavpack/WavPackToken.d.ts +18 -14
- package/node_modules/music-metadata/lib/wavpack/WavPackToken.js +30 -24
- package/node_modules/music-metadata/package.json +74 -81
- package/node_modules/{music-metadata/node_modules/strtok3/LICENSE.txt → turndown-plugin-gfm/LICENSE} +21 -21
- package/node_modules/turndown-plugin-gfm/README.md +50 -0
- package/node_modules/turndown-plugin-gfm/dist/turndown-plugin-gfm.js +165 -0
- package/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.browser.cjs.js +162 -0
- package/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.browser.es.js +154 -0
- package/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.cjs.js +162 -0
- package/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.es.js +154 -0
- package/node_modules/turndown-plugin-gfm/package.json +43 -0
- package/package.json +5 -5
- package/node_modules/@borewit/text-codec/LICENSE.txt +0 -9
- package/node_modules/@borewit/text-codec/README.md +0 -87
- package/node_modules/@borewit/text-codec/lib/index.d.ts +0 -6
- package/node_modules/@borewit/text-codec/lib/index.js +0 -380
- package/node_modules/@borewit/text-codec/package.json +0 -70
- package/node_modules/music-metadata/lib/ParseError.d.ts +0 -87
- package/node_modules/music-metadata/lib/ParseError.js +0 -38
- package/node_modules/music-metadata/lib/aiff/AiffLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/aiff/AiffLoader.js +0 -8
- package/node_modules/music-metadata/lib/apev2/Apev2Loader.d.ts +0 -2
- package/node_modules/music-metadata/lib/apev2/Apev2Loader.js +0 -8
- package/node_modules/music-metadata/lib/asf/AsfGuid.d.ts +0 -83
- package/node_modules/music-metadata/lib/asf/AsfGuid.js +0 -109
- package/node_modules/music-metadata/lib/asf/AsfLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/asf/AsfLoader.js +0 -8
- package/node_modules/music-metadata/lib/dsdiff/DsdiffLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/dsdiff/DsdiffLoader.js +0 -8
- package/node_modules/music-metadata/lib/dsf/DsfLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/dsf/DsfLoader.js +0 -8
- package/node_modules/music-metadata/lib/ebml/EbmlIterator.d.ts +0 -67
- package/node_modules/music-metadata/lib/ebml/EbmlIterator.js +0 -218
- package/node_modules/music-metadata/lib/ebml/types.d.ts +0 -37
- package/node_modules/music-metadata/lib/ebml/types.js +0 -8
- package/node_modules/music-metadata/lib/flac/FlacLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/flac/FlacLoader.js +0 -8
- package/node_modules/music-metadata/lib/flac/FlacToken.d.ts +0 -45
- package/node_modules/music-metadata/lib/flac/FlacToken.js +0 -63
- package/node_modules/music-metadata/lib/id3v2/FrameHeader.d.ts +0 -31
- package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +0 -73
- package/node_modules/music-metadata/lib/id3v2/ID3v2ChapterToken.d.ts +0 -11
- package/node_modules/music-metadata/lib/id3v2/ID3v2ChapterToken.js +0 -17
- package/node_modules/music-metadata/lib/lrc/LyricsParser.d.ts +0 -9
- package/node_modules/music-metadata/lib/lrc/LyricsParser.js +0 -45
- package/node_modules/music-metadata/lib/matroska/MatroskaLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/matroska/MatroskaLoader.js +0 -8
- package/node_modules/music-metadata/lib/mp4/Mp4Loader.d.ts +0 -2
- package/node_modules/music-metadata/lib/mp4/Mp4Loader.js +0 -8
- package/node_modules/music-metadata/lib/mpeg/MpegLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/mpeg/MpegLoader.js +0 -8
- package/node_modules/music-metadata/lib/musepack/MusepackConentError.d.ts +0 -15
- package/node_modules/music-metadata/lib/musepack/MusepackConentError.js +0 -3
- package/node_modules/music-metadata/lib/musepack/MusepackLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/musepack/MusepackLoader.js +0 -8
- package/node_modules/music-metadata/lib/musepack/MusepackParser.d.ts +0 -4
- package/node_modules/music-metadata/lib/musepack/MusepackParser.js +0 -30
- package/node_modules/music-metadata/lib/ogg/OggLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/ogg/OggLoader.js +0 -8
- package/node_modules/music-metadata/lib/ogg/OggToken.js +0 -41
- package/node_modules/music-metadata/lib/ogg/flac/FlacStream.d.ts +0 -29
- package/node_modules/music-metadata/lib/ogg/flac/FlacStream.js +0 -74
- package/node_modules/music-metadata/lib/ogg/opus/OpusStream.d.ts +0 -24
- package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +0 -20
- package/node_modules/music-metadata/lib/ogg/theora/TheoraStream.d.ts +0 -25
- package/node_modules/music-metadata/lib/ogg/theora/TheoraStream.js +0 -39
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.d.ts +0 -53
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.js +0 -136
- package/node_modules/music-metadata/lib/wav/WaveLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/wav/WaveLoader.js +0 -8
- package/node_modules/music-metadata/lib/wavpack/WavPackLoader.d.ts +0 -2
- package/node_modules/music-metadata/lib/wavpack/WavPackLoader.js +0 -8
- package/node_modules/music-metadata/node_modules/file-type/core.d.ts +0 -253
- package/node_modules/music-metadata/node_modules/file-type/core.js +0 -2899
- package/node_modules/music-metadata/node_modules/file-type/index.d.ts +0 -98
- package/node_modules/music-metadata/node_modules/file-type/index.js +0 -163
- package/node_modules/music-metadata/node_modules/file-type/license +0 -9
- package/node_modules/music-metadata/node_modules/file-type/package.json +0 -290
- package/node_modules/music-metadata/node_modules/file-type/readme.md +0 -667
- package/node_modules/music-metadata/node_modules/file-type/supported.js +0 -360
- package/node_modules/music-metadata/node_modules/file-type/util.js +0 -60
- package/node_modules/music-metadata/node_modules/strtok3/README.md +0 -399
- package/node_modules/music-metadata/node_modules/strtok3/lib/AbstractTokenizer.d.ts +0 -76
- package/node_modules/music-metadata/node_modules/strtok3/lib/AbstractTokenizer.js +0 -111
- package/node_modules/music-metadata/node_modules/strtok3/lib/BlobTokenizer.d.ts +0 -29
- package/node_modules/music-metadata/node_modules/strtok3/lib/BlobTokenizer.js +0 -53
- package/node_modules/music-metadata/node_modules/strtok3/lib/BufferTokenizer.d.ts +0 -29
- package/node_modules/music-metadata/node_modules/strtok3/lib/BufferTokenizer.js +0 -52
- package/node_modules/music-metadata/node_modules/strtok3/lib/FileTokenizer.d.ts +0 -37
- package/node_modules/music-metadata/node_modules/strtok3/lib/FileTokenizer.js +0 -61
- package/node_modules/music-metadata/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts +0 -34
- package/node_modules/music-metadata/node_modules/strtok3/lib/ReadStreamTokenizer.js +0 -107
- package/node_modules/music-metadata/node_modules/strtok3/lib/core.d.ts +0 -40
- package/node_modules/music-metadata/node_modules/strtok3/lib/core.js +0 -62
- package/node_modules/music-metadata/node_modules/strtok3/lib/index.d.ts +0 -16
- package/node_modules/music-metadata/node_modules/strtok3/lib/index.js +0 -22
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/AbstractStreamReader.d.ts +0 -54
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/AbstractStreamReader.js +0 -71
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/Deferred.d.ts +0 -6
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/Deferred.js +0 -10
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/Errors.d.ts +0 -10
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/Errors.js +0 -16
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/StreamReader.d.ts +0 -29
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/StreamReader.js +0 -83
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamByobReader.d.ts +0 -14
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamByobReader.js +0 -27
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamDefaultReader.d.ts +0 -19
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamDefaultReader.js +0 -62
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamReader.d.ts +0 -14
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamReader.js +0 -13
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamReaderFactory.d.ts +0 -5
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/WebStreamReaderFactory.js +0 -19
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/index.d.ts +0 -6
- package/node_modules/music-metadata/node_modules/strtok3/lib/stream/index.js +0 -5
- package/node_modules/music-metadata/node_modules/strtok3/lib/types.d.ts +0 -139
- package/node_modules/music-metadata/node_modules/strtok3/lib/types.js +0 -1
- package/node_modules/music-metadata/node_modules/strtok3/package.json +0 -94
- package/node_modules/music-metadata/node_modules/token-types/LICENSE.txt +0 -9
- package/node_modules/music-metadata/node_modules/token-types/README.md +0 -120
- package/node_modules/music-metadata/node_modules/token-types/lib/index.d.ts +0 -135
- package/node_modules/music-metadata/node_modules/token-types/lib/index.js +0 -401
- package/node_modules/music-metadata/node_modules/token-types/package.json +0 -81
- package/node_modules/sprintf-js/.npmignore +0 -1
- package/node_modules/sprintf-js/LICENSE +0 -24
- package/node_modules/sprintf-js/README.md +0 -88
- package/node_modules/sprintf-js/bower.json +0 -14
- package/node_modules/sprintf-js/demo/angular.html +0 -20
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js +0 -4
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +0 -1
- package/node_modules/sprintf-js/dist/angular-sprintf.min.map +0 -1
- package/node_modules/sprintf-js/dist/sprintf.min.js +0 -4
- package/node_modules/sprintf-js/dist/sprintf.min.js.map +0 -1
- package/node_modules/sprintf-js/dist/sprintf.min.map +0 -1
- package/node_modules/sprintf-js/gruntfile.js +0 -36
- package/node_modules/sprintf-js/package.json +0 -22
- package/node_modules/sprintf-js/src/angular-sprintf.js +0 -18
- package/node_modules/sprintf-js/src/sprintf.js +0 -208
- package/node_modules/sprintf-js/test/test.js +0 -82
- package/node_modules/uint8array-extras/index.d.ts +0 -331
- package/node_modules/uint8array-extras/index.js +0 -318
- package/node_modules/uint8array-extras/license +0 -9
- package/node_modules/uint8array-extras/package.json +0 -54
- package/node_modules/uint8array-extras/readme.md +0 -318
- package/node_modules/win-guid/LICENSE.txt +0 -9
- package/node_modules/win-guid/README.md +0 -113
- package/node_modules/win-guid/lib/guid.d.ts +0 -20
- package/node_modules/win-guid/lib/guid.js +0 -107
- package/node_modules/win-guid/package.json +0 -55
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/LICENSE +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/README.md +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/index.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/append/constant.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/append.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/count.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/help.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/store/constant.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/store/false.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/store/true.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/store.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/subparsers.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action/version.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/action_container.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/argparse.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/argument/error.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/argument/exclusive.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/argument/group.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/argument_parser.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/const.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/help/added_formatters.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/help/formatter.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/namespace.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/lib/utils.js +0 -0
- /package/node_modules/{argparse → mammoth/node_modules/argparse}/package.json +0 -0
|
@@ -1,90 +1,62 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
|
+
[](https://ci.appveyor.com/project/Borewit/music-metadata/branch/commonjs)
|
|
2
3
|
[](https://npmjs.org/package/music-metadata)
|
|
3
|
-
[](https://npmcharts.com/compare/music-metadata?start=600
|
|
4
|
-
[](https://npmcharts.com/compare/music-metadata,jsmediatags,musicmetadata,node-id3,mp3-parser,id3-parser,wav-file-info?start=600)
|
|
5
|
+
[](https://coveralls.io/github/Borewit/music-metadata?branch=commonjs)
|
|
5
6
|
[](https://app.codacy.com/app/Borewit/music-metadata?utm_source=github.com&utm_medium=referral&utm_content=Borewit/music-metadata&utm_campaign=Badge_Grade_Dashboard)
|
|
6
|
-
[](https://github.com/Borewit/music-metadata/actions/workflows/codeql-analysis.yml)
|
|
7
|
+
[](https://github.com/Borewit/music-metadata/actions/workflows/codeql-analysis.yml)
|
|
7
8
|
[](https://deepscan.io/dashboard#view=project&tid=5165&pid=6938&bid=61821)
|
|
8
9
|
[](https://snyk.io/test/github/Borewit/music-metadata?targetFile=package.json)
|
|
10
|
+
[](https://discord.gg/KyBr6sb)
|
|
9
11
|
|
|
10
12
|
# music-metadata
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- **Comprehensive Format Support**: Supports popular audio formats like MP3, MP4, FLAC, Ogg, WAV, AIFF, and more.
|
|
16
|
-
- **Extensive Metadata Extraction**: Extracts detailed metadata, including ID3v1, ID3v2, APE, Vorbis, and iTunes/MP4 tags.
|
|
17
|
-
- **Streaming Support**: Efficiently handles large audio files by reading metadata from streams, making it suitable for server-side and browser-based applications.
|
|
18
|
-
- **Promise-Based API**: Provides a modern, promise-based API for easy integration into asynchronous workflows.
|
|
19
|
-
- **Cross-Platform**: Works in both [Node.js](https://nodejs.org/) and browser environments with the help of bundlers like [Webpack](https://webpack.js.org/) or [Rollup](https://rollupjs.org/introduction/).
|
|
20
|
-
|
|
21
|
-
The [`music-metadata`](https://github.com/Borewit/music-metadata) module is ideal for developers working on media applications, music players, or any project that requires access to detailed audio file metadata.
|
|
22
|
-
|
|
23
|
-
## Compatibility
|
|
24
|
-
|
|
25
|
-
Module: version 8 migrated from [CommonJS](https://en.wikipedia.org/wiki/CommonJS) to [pure ECMAScript Module (ESM)](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
|
|
26
|
-
The distributed JavaScript codebase is compliant with the [ECMAScript 2020 (11th Edition)](https://en.wikipedia.org/wiki/ECMAScript_version_history#11th_Edition_%E2%80%93_ECMAScript_2020) standard.
|
|
27
|
-
|
|
28
|
-
> [!NOTE]
|
|
29
|
-
> See also [CommonJS backward Compatibility](#commonjs-backward-compatibility)
|
|
30
|
-
|
|
31
|
-
This module requires a [Node.js ≥ 18](https://nodejs.org/en/about/previous-releases) engine.
|
|
32
|
-
It can also be used in a browser environment when bundled with a module bundler.
|
|
33
|
-
|
|
34
|
-
## Support the Project
|
|
35
|
-
If you find this project useful and would like to support its development, consider sponsoring or contributing:
|
|
36
|
-
|
|
37
|
-
- [Become a sponsor to Borewit](https://github.com/sponsors/Borewit)
|
|
38
|
-
|
|
39
|
-
- Buy me a coffee:
|
|
40
|
-
|
|
41
|
-
<a href="https://www.buymeacoffee.com/borewit" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy me A coffee" height="41" width="174"></a>
|
|
14
|
+
Stream and file based music metadata parser for [node.js](https://nodejs.org/).
|
|
15
|
+
Supports any common audio and tagging format.
|
|
16
|
+
[TypeScript](https://www.typescriptlang.org/) definitions are included.
|
|
42
17
|
|
|
43
18
|
## Features
|
|
44
19
|
|
|
45
20
|
### Support for audio file types
|
|
46
21
|
|
|
47
|
-
| Audio format
|
|
48
|
-
|
|
49
|
-
|
|
|
50
|
-
| [
|
|
51
|
-
| [
|
|
52
|
-
| [
|
|
53
|
-
| [
|
|
54
|
-
| [
|
|
55
|
-
| [
|
|
56
|
-
| [
|
|
57
|
-
| [
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
| [
|
|
61
|
-
|
|
|
62
|
-
| [
|
|
63
|
-
| [
|
|
64
|
-
| [
|
|
65
|
-
| [
|
|
66
|
-
| [
|
|
67
|
-
| [
|
|
68
|
-
| [
|
|
69
|
-
| [
|
|
70
|
-
| [
|
|
22
|
+
| Audio format | Description | Wiki | |
|
|
23
|
+
| ------------- |---------------------------------| -------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------:|
|
|
24
|
+
| AIFF / AIFF-C | Audio Interchange File Format | [:link:](https://wikipedia.org/wiki/Audio_Interchange_File_Format) | <img src="https://upload.wikimedia.org/wikipedia/commons/8/84/Apple_Computer_Logo_rainbow.svg" width="40" alt="Apple rainbow logo"> |
|
|
25
|
+
| AAC | ADTS / Advanced Audio Coding | [:link:](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) | <img src="https://svgshare.com/i/UT8.svg" width="40" alt="AAC logo"> |
|
|
26
|
+
| APE | Monkey's Audio | [:link:](https://wikipedia.org/wiki/Monkey's_Audio) | <img src="https://foreverhits.files.wordpress.com/2015/05/ape_audio.jpg" width="40" alt="Monkey's Audio logo"> |
|
|
27
|
+
| ASF | Advanced Systems Format | [:link:](https://wikipedia.org/wiki/Advanced_Systems_Format) | |
|
|
28
|
+
| BWF | Broadcast Wave Format | [:link:](https://en.wikipedia.org/wiki/Broadcast_Wave_Format) | |
|
|
29
|
+
| DSDIFF | Philips DSDIFF | [:link:](https://wikipedia.org/wiki/Direct_Stream_Digital) | <img src="https://upload.wikimedia.org/wikipedia/commons/b/bc/DSDlogo.svg" width="80" alt="DSD logo"> |
|
|
30
|
+
| DSF | Sony's DSD Stream File | [:link:](https://wikipedia.org/wiki/Direct_Stream_Digital) | <img src="https://upload.wikimedia.org/wikipedia/commons/b/bc/DSDlogo.svg" width="80" alt="DSD logo"> |
|
|
31
|
+
| FLAC | Free Lossless Audio Codec | [:link:](https://wikipedia.org/wiki/FLAC) | <img src="https://upload.wikimedia.org/wikipedia/commons/a/a2/FLAC_logo_vector.svg" width="80" alt="FLAC logo"> |
|
|
32
|
+
| MP2 | MPEG-1 Audio Layer II | [:link:](https://wikipedia.org/wiki/MPEG-1_Audio_Layer_II) | |
|
|
33
|
+
| Matroska | Matroska (EBML), mka, mkv | [:link:](https://wikipedia.org/wiki/Matroska) | <img src="https://upload.wikimedia.org/wikipedia/commons/1/1a/Matroska_2010.svg" width="80" alt="Matroska logo"> |
|
|
34
|
+
| MP3 | MPEG-1 / MPEG-2 Audio Layer III | [:link:](https://wikipedia.org/wiki/MP3) | <img src="https://upload.wikimedia.org/wikipedia/commons/e/ea/Mp3.svg" width="80" alt="MP3 logo"> |
|
|
35
|
+
| MPC | Musepack SV7 | [:link:](https://wikipedia.org/wiki/Musepack) | <img src="https://www.musepack.net/pictures/musepack_logo.png" width="80" alt="musepack logo"> |
|
|
36
|
+
| MPEG 4 | mp4, m4a, m4v | [:link:](https://wikipedia.org/wiki/MPEG-4) | <img src="https://svgshare.com/i/UU3.svg" width="80" alt="mpeg 4 logo"> |
|
|
37
|
+
| Ogg | Open container format | [:link:](https://en.wikipedia.org/wiki/Ogg) | <img src="https://upload.wikimedia.org/wikipedia/commons/a/a1/Ogg_Logo.svg" width="80" alt="Ogg logo"> |
|
|
38
|
+
| Opus | | [:link:](https://wikipedia.org/wiki/Opus_(audio_format)) | <img src="https://upload.wikimedia.org/wikipedia/commons/0/02/Opus_logo2.svg" width="80" alt="Opus logo"> |
|
|
39
|
+
| Speex | | [:link:](https://wikipedia.org/wiki/Speex) | <img src="https://upload.wikimedia.org/wikipedia/commons/b/b5/Speex_logo_2006.svg" width="80" alt="Speex logo"> |
|
|
40
|
+
| Theora | | [:link:](https://en.wikipedia.org/wiki/Theora) | <img src="https://upload.wikimedia.org/wikipedia/commons/5/57/Theora_logo_2007.svg" width="70" alt="Theora logo"> |
|
|
41
|
+
| Vorbis | Vorbis audio compression | [:link:](https://wikipedia.org/wiki/Ogg_Vorbis) | <img src="https://upload.wikimedia.org/wikipedia/commons/8/8d/Xiph.Org_logo_square.svg" width="70" alt="Vorbis logo"> |
|
|
42
|
+
| WAV | RIFF WAVE | [:link:](https://wikipedia.org/wiki/WAV) | |
|
|
43
|
+
| WebM | webm | [:link:](https://wikipedia.org/wiki/WebM) | <img src="https://upload.wikimedia.org/wikipedia/commons/3/34/WebM_logo.svg" width="80" alt="Matroska logo"> |
|
|
44
|
+
| WV | WavPack | [:link:](https://wikipedia.org/wiki/WavPack) | <img src="http://www.wavpack.com/wavpacklogo.svg" width="60" alt="WavPack logo"> |
|
|
45
|
+
| WMA | Windows Media Audio | [:link:](https://wikipedia.org/wiki/Windows_Media_Audio) | <img src="https://upload.wikimedia.org/wikipedia/commons/7/76/Windows_Media_Player_simplified_logo.svg" width="40" alt="Windows Media logo"> |
|
|
71
46
|
|
|
72
47
|
### Supported tag headers
|
|
73
48
|
|
|
74
49
|
Following tag header formats are supported:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
- [LRC](https://en.wikipedia.org/wiki/LRC_(file_format))
|
|
86
|
-
- Synchronized lyrics (SYLT)
|
|
87
|
-
- Unsynchronized lyrics (USULT)
|
|
50
|
+
* [APE](https://wikipedia.org/wiki/APE_tag)
|
|
51
|
+
* [ASF](https://wikipedia.org/wiki/Advanced_Systems_Format)
|
|
52
|
+
* EXIF 2.3
|
|
53
|
+
* [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)
|
|
54
|
+
* [iTunes](https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata)
|
|
55
|
+
* [RIFF](https://wikipedia.org/wiki/Resource_Interchange_File_Format)/INFO
|
|
56
|
+
* [Vorbis comment](https://wikipedia.org/wiki/Vorbis_comment)
|
|
57
|
+
* [AIFF](https://wikipedia.org/wiki/Audio_Interchange_File_Format)
|
|
58
|
+
|
|
59
|
+
It allows many tags to be accessed in audio format, and tag format independent way.
|
|
88
60
|
|
|
89
61
|
Support for [MusicBrainz](https://musicbrainz.org/) tags as written by [Picard](https://picard.musicbrainz.org/).
|
|
90
62
|
[ReplayGain](https://wiki.hydrogenaud.io/index.php?title=ReplayGain) tags are supported.
|
|
@@ -92,17 +64,40 @@ Support for [MusicBrainz](https://musicbrainz.org/) tags as written by [Picard](
|
|
|
92
64
|
### Audio format & encoding details
|
|
93
65
|
|
|
94
66
|
Support for encoding / format details:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
67
|
+
* [Bit rate](https://wikipedia.org/wiki/Bit_rate)
|
|
68
|
+
* [Audio bit depth](https://wikipedia.org/wiki/Audio_bit_depth)
|
|
69
|
+
* Duration
|
|
70
|
+
* Encoding profile (e.g. [CBR](https://en.wikipedia.org/wiki/Constant_bitrate), V0, V2)
|
|
71
|
+
|
|
100
72
|
|
|
101
73
|
## Online demo's
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
74
|
+
* [<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.com/)
|
|
75
|
+
* [<img src="https://cdn.sanity.io/images/3do82whm/next/ba8c847f13a5fa39d88f8bc9b7846b7886531b18-2500x2500.svg" width="40"> Webamp](https://webamp.org/)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## Compatibility
|
|
79
|
+
|
|
80
|
+
The JavaScript in runtime is compliant with [ECMAScript 2017 (ES8)](https://en.wikipedia.org/wiki/ECMAScript#8th_Edition_-_ECMAScript_2017).
|
|
81
|
+
Requires [Node.js®](https://nodejs.org/) version 6 or higher.
|
|
82
|
+
|
|
83
|
+
### Browser Support
|
|
84
|
+
|
|
85
|
+
Although music-metadata is designed to run the node.js. [music-metadata-browser](https://github.com/Borewit/music-metadata-browser) can be used on the browser side.
|
|
86
|
+
|
|
87
|
+
To avoid Node `fs` dependency inclusion, you may use a sub-module inclusion:
|
|
88
|
+
```js
|
|
89
|
+
import * as mm from 'music-metadata/lib/core';
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| function | `music-metadata` | `music-metadata/lib/core` |
|
|
93
|
+
|------------------------------------------------------| ---------------------------|----------------------------|
|
|
94
|
+
| [`parseBuffer`](#parsebuffer-function) | ✓ | ✓ |
|
|
95
|
+
| [`parseStream`](#parsestream-function) * | ✓ | ✓ |
|
|
96
|
+
| [`parseFromTokenizer`](#parsefromtokenizer-function) | ✓ | ✓ |
|
|
97
|
+
| [`parseFile`](#parsefile-function) | ✓ | |
|
|
98
|
+
|
|
99
|
+
### Sponsor
|
|
100
|
+
[Become a sponsor to Borewit](https://github.com/sponsors/Borewit)
|
|
106
101
|
|
|
107
102
|
## Usage
|
|
108
103
|
|
|
@@ -117,433 +112,102 @@ or using [yarn](https://yarnpkg.com/):
|
|
|
117
112
|
yarn add music-metadata
|
|
118
113
|
```
|
|
119
114
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
### Overview
|
|
123
|
-
|
|
124
|
-
**Node.js specific** functions to read an audio file or stream:
|
|
125
|
-
1. **File Parsing**: Parse audio files directly from the filesystem using the [parseFile function](#parsefile-function)
|
|
126
|
-
1. **Stream Parsing**: Parse audio metadata from a Node.js [Readable stream](https://nodejs.org/api/stream.html#class-streamreadable) using the [parseStream function](#parsewebstream-function).
|
|
127
|
-
|
|
128
|
-
**Cross-platform** functions available to read an audio file or stream:
|
|
129
|
-
|
|
130
|
-
There are multiple ways to parse (read) audio tracks:
|
|
131
|
-
1. **Web Stream Parsing**: Parse audio data from a web-compatible [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream) using the [parseWebStream function](#parsewebstream-function).
|
|
132
|
-
1. **Blob Parsing**: Parse audio metadata from a (Web API) [Blob](https://developer.mozilla.org/docs/Web/API/Blob) or [File](https://developer.mozilla.org/docs/Web/API/File) using the [parseBlob function](#parseblob-function).
|
|
133
|
-
1. **Buffer Parsing**: Parse audio metadata from a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) or [Buffer](https://nodejs.org/api/buffer.html) using the [parseBuffer function](#parsebuffer-function).
|
|
134
|
-
1. **Tokenizer Parsing:** Use a custom or third-party [strtok3](https://github.com/Borewit/strtok3) `ITokenizer` to parse using the [parseFromTokenizer function](#parsefromtokenizer-function).
|
|
135
|
-
|
|
136
|
-
> [!NOTE]
|
|
137
|
-
> Direct file access in Node.js is generally faster because it can 'jump' to various parts of the file without reading intermediate data.
|
|
138
|
-
|
|
139
|
-
### Node.js specific function
|
|
140
|
-
These functions are tailored for Node.js environments and leverage Node.js-specific APIs,
|
|
141
|
-
making them incompatible with browser-based JavaScript engines.
|
|
115
|
+
### Import music-metadata
|
|
142
116
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
It reads the specified file, parses its audio metadata, and returns a promise that resolves with this information.
|
|
147
|
-
|
|
148
|
-
##### Syntax
|
|
149
|
-
```ts
|
|
150
|
-
parseFile(filePath: string, options?: IOptions): Promise<IAudioMetadata>
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
##### Parameters
|
|
154
|
-
|
|
155
|
-
- `filePath`: `string`
|
|
156
|
-
|
|
157
|
-
The path to the media file from which metadata should be extracted.
|
|
158
|
-
This should be a valid path to an audio file on the local filesystem.
|
|
159
|
-
|
|
160
|
-
- `options`: [IOptions](#ioptions-interface) (optional)
|
|
161
|
-
|
|
162
|
-
An optional configuration object that allows customization of the parsing process.
|
|
163
|
-
These options can include whether to calculate the file's duration, skip embedded cover art,
|
|
164
|
-
or other parsing behaviors.
|
|
165
|
-
|
|
166
|
-
##### Returns
|
|
167
|
-
|
|
168
|
-
- `Promise<IAudioMetadata>`:
|
|
169
|
-
|
|
170
|
-
A promise that resolves to an IAudioMetadata object containing metadata about the audio file.
|
|
171
|
-
The metadata includes details such as the file format, codec, duration, bit rate, and any embedded tags like album, artist, or track information.
|
|
172
|
-
|
|
173
|
-
##### Usage Notes
|
|
174
|
-
|
|
175
|
-
- This function is **Node.js-only** and relies on Node.js-specific APIs to access the filesystem.
|
|
176
|
-
|
|
177
|
-
- For browser environments, consider using the [parseBlob](#parseblob-function) to parse [File object](https://developer.mozilla.org/en-US/docs/Web/API/File) objects.
|
|
178
|
-
|
|
179
|
-
##### Example:
|
|
180
|
-
|
|
181
|
-
The following example demonstrates how to use the parseFile function to read metadata from an audio file:
|
|
182
|
-
```js
|
|
183
|
-
import { parseFile } from 'music-metadata';
|
|
184
|
-
import { inspect } from 'node:util';
|
|
185
|
-
|
|
186
|
-
(async () => {
|
|
187
|
-
try {
|
|
188
|
-
const filePath = 'test/samples/MusicBrainz - Beth Hart - Sinner\'s Prayer [id3v2.3].V2.mp3';
|
|
189
|
-
const metadata = await parseFile(filePath);
|
|
190
|
-
|
|
191
|
-
// Output the parsed metadata to the console in a readable format
|
|
192
|
-
console.log(inspect(metadata, { showHidden: false, depth: null }));
|
|
193
|
-
} catch (error) {
|
|
194
|
-
console.error('Error parsing metadata:', error.message);
|
|
195
|
-
}
|
|
196
|
-
})();
|
|
117
|
+
Import music-metadata in JavaScript:
|
|
118
|
+
```JavaScript
|
|
119
|
+
const mm = require('music-metadata');
|
|
197
120
|
```
|
|
198
121
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
The parseStream function is used to parse metadata from an audio track provided as a Node.js [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) stream.
|
|
202
|
-
This is particularly useful for processing audio data that is being streamed or piped from another source, such as a web server or file system.
|
|
203
|
-
|
|
204
|
-
##### Syntax:
|
|
122
|
+
This is how it's done in TypeScript:
|
|
205
123
|
```ts
|
|
206
|
-
|
|
124
|
+
import * as mm from 'music-metadata';
|
|
207
125
|
```
|
|
208
126
|
|
|
209
|
-
|
|
127
|
+
### Module Functions
|
|
210
128
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
This stream should provide the raw audio data to be analyzed.
|
|
129
|
+
There are two ways to parse (read) audio tracks:
|
|
130
|
+
1) Audio (music) files can be parsed using direct file access using the [parseFile function](#parsefile)
|
|
131
|
+
2) Using [Node.js streams](https://nodejs.org/api/stream.html) using the [parseStream function](#parseStream).
|
|
215
132
|
|
|
216
|
-
|
|
133
|
+
Direct file access tends to be a little faster, because it can 'jump' to various parts in the file without being obliged to read intermediate data.
|
|
217
134
|
|
|
218
|
-
|
|
219
|
-
The fileInfo parameter can help the parser to correctly identify the audio format and may include:
|
|
135
|
+
#### parseFile function
|
|
220
136
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
If provided, it is assumed the streamed file content is to be the MIME-type.
|
|
224
|
-
If not provided, the parser will attempt to determine the format based on the content of the stream.
|
|
225
|
-
|
|
226
|
-
- `size`: The total size of the audio stream in bytes (useful for streams with a known length).
|
|
227
|
-
|
|
228
|
-
- `path`: A string representing the file path or filename, which can also assist in determining the format.
|
|
229
|
-
|
|
230
|
-
- `options`: `IOptions` (optional)
|
|
231
|
-
|
|
232
|
-
An optional object containing additional parsing options.
|
|
233
|
-
These options allow you to customize the parsing process,
|
|
234
|
-
such as whether to calculate the duration or skip cover art extraction.
|
|
235
|
-
|
|
236
|
-
##### Returns
|
|
237
|
-
|
|
238
|
-
- `Promise<IAudioMetadata>`:
|
|
239
|
-
|
|
240
|
-
A promise that resolves to an `IAudioMetadata` object containing detailed metadata about the audio stream.
|
|
241
|
-
This metadata includes information about the format, codec, duration, bitrate, and any embedded tags such as artist, album, or track information.
|
|
242
|
-
|
|
243
|
-
##### Usage Notes
|
|
244
|
-
- This function is only available in Node.js environments, as it relies on the [Node.js stream API](https://nodejs.org/api/stream.html).
|
|
245
|
-
|
|
246
|
-
##### Example:
|
|
247
|
-
|
|
248
|
-
The following example demonstrates how to use the `parseStream` function to read metadata from an audio stream:
|
|
249
|
-
```js
|
|
250
|
-
import { parseStream } from 'music-metadata';
|
|
251
|
-
import { createReadStream } from 'fs';
|
|
252
|
-
|
|
253
|
-
(async () => {
|
|
254
|
-
try {
|
|
255
|
-
// Create a readable stream from a file
|
|
256
|
-
const audioStream = createReadStream('path/to/audio/file.mp3');
|
|
257
|
-
|
|
258
|
-
// Parse the metadata from the stream
|
|
259
|
-
const metadata = await parseStream(audioStream, { mimeType: 'audio/mpeg'});
|
|
260
|
-
|
|
261
|
-
// Log the parsed metadata
|
|
262
|
-
console.log(metadata);
|
|
263
|
-
} catch (error) {
|
|
264
|
-
console.error('Error parsing metadata:', error.message);
|
|
265
|
-
}
|
|
266
|
-
})();
|
|
137
|
+
Parses the specified file (`filePath`) and returns a promise with the metadata result (`IAudioMetadata`).
|
|
267
138
|
|
|
268
139
|
```
|
|
269
|
-
|
|
270
|
-
### Cross-platform functions
|
|
271
|
-
These functions are designed to be cross-platform,
|
|
272
|
-
meaning it can be used in both Node.js and web browsers.
|
|
273
|
-
|
|
274
|
-
#### `parseWebStream` function
|
|
275
|
-
|
|
276
|
-
The parseWebStream function is used to extract metadata from an audio track provided as a web-compatible ReadableStream.
|
|
277
|
-
This function is ideal for applications running in web environments, such as browsers,
|
|
278
|
-
where audio data is streamed over the network or read from other web-based sources.
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
##### Syntax
|
|
282
|
-
```ts
|
|
283
|
-
parseWebStream(webStream: ReadableStream<Uint8Array>, fileInfo?: IFileInfo | string, options?: IOptions): Promise<IAudioMetadata>
|
|
140
|
+
parseFile(filePath: string, opts: IOptions = {}): Promise<IAudioMetadata>`
|
|
284
141
|
```
|
|
285
142
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
- `webStream`: `ReadableStream<Uint8Array>`
|
|
289
|
-
|
|
290
|
-
A [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream) that provides the audio data to be parsed.
|
|
291
|
-
This stream should emit Uint8Array chunks, representing the raw audio data.
|
|
292
|
-
|
|
293
|
-
- `fileInfo`: `IFileInfo` (optional)
|
|
294
|
-
|
|
295
|
-
An object containing file-related information or a string representing the MIME-type of the audio stream.
|
|
296
|
-
The fileInfo parameter can help the parser to correctly identify the audio format and may include:
|
|
297
|
-
|
|
298
|
-
- `mimeType`: A string representing the [MIME-type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) (e.g., `audio/mpeg`).
|
|
299
|
-
|
|
300
|
-
If provided, it is assumed the streamed file content is to be the MIME-type.
|
|
301
|
-
If not provided, the parser will attempt to determine the format based on the content of the stream.
|
|
302
|
-
|
|
303
|
-
- `size`: The total size of the audio stream in bytes (useful for streams with a known length).
|
|
304
|
-
|
|
305
|
-
- `path`: A string representing the file path or filename, which can also assist in determining the format.
|
|
306
|
-
|
|
307
|
-
- `options`: `IOptions` (optional)
|
|
308
|
-
|
|
309
|
-
An optional object containing additional parsing options.
|
|
310
|
-
These options allow you to customize the parsing process,
|
|
311
|
-
such as whether to calculate the duration or skip cover art extraction.
|
|
312
|
-
|
|
313
|
-
##### Returns
|
|
314
|
-
|
|
315
|
-
- `Promise<IAudioMetadata>`:
|
|
316
|
-
|
|
317
|
-
A promise that resolves to an `IAudioMetadata` object containing detailed metadata about the audio stream.
|
|
318
|
-
This metadata includes information about the format, codec, duration, bitrate, and any embedded tags such as artist, album, or track information.
|
|
319
|
-
|
|
320
|
-
##### Example
|
|
321
|
-
Here’s an example of how to use the `parseWebStream` function to extract metadata from an audio stream in a web application:
|
|
322
|
-
|
|
143
|
+
Example:
|
|
323
144
|
```js
|
|
324
|
-
|
|
145
|
+
const mm = require('music-metadata');
|
|
146
|
+
const util = require('util');
|
|
325
147
|
|
|
326
148
|
(async () => {
|
|
327
149
|
try {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
// Extract the Content-Length header and convert it to a number
|
|
332
|
-
const contentLength = response.headers.get('Content-Length');
|
|
333
|
-
const size = contentLength ? parseInt(contentLength, 10) : undefined;
|
|
334
|
-
|
|
335
|
-
// Parse the metadata from the web stream
|
|
336
|
-
const metadata = await parseWebStream(response.body, {
|
|
337
|
-
mimeType: response.headers.get('Content-Type'),
|
|
338
|
-
size // Important to pass the content-length
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
console.log(metadata);
|
|
150
|
+
const metadata = await mm.parseFile('../music-metadata/test/samples/MusicBrainz - Beth Hart - Sinner\'s Prayer [id3v2.3].V2.mp3');
|
|
151
|
+
console.log(util.inspect(metadata, { showHidden: false, depth: null }));
|
|
342
152
|
} catch (error) {
|
|
343
|
-
console.error(
|
|
153
|
+
console.error(error.message);
|
|
344
154
|
}
|
|
345
155
|
})();
|
|
346
156
|
```
|
|
347
157
|
|
|
348
|
-
|
|
349
|
-
The `response.body` provides a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream) that is then passed to `parseWebStream`.
|
|
350
|
-
|
|
351
|
-
#### `parseBlob` function
|
|
158
|
+
#### parseStream function
|
|
352
159
|
|
|
353
|
-
Parses
|
|
354
|
-
|
|
160
|
+
Parses the provided audio stream for metadata.
|
|
161
|
+
It is recommended to provide the corresponding [MIME-type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types).
|
|
162
|
+
An extension (e.g.: `.mp3`), filename or path will also work.
|
|
163
|
+
If the MIME-type or filename (via `fileInfo.path`) is not provided, or not understood, music-metadata will try to derive the type from the content.
|
|
355
164
|
|
|
356
|
-
##### Syntax
|
|
357
165
|
```ts
|
|
358
|
-
|
|
166
|
+
parseStream(stream: Stream.Readable, fileInfo?: IFileInfo | string, opts?: IOptions = {}): Promise<IAudioMetadata>`
|
|
359
167
|
```
|
|
360
168
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
- `blob`: [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
364
|
-
|
|
365
|
-
The Blob object containing the audio data to be parsed.
|
|
366
|
-
This can be a file or any binary data. If the Blob is an instance of File, its name will be used as the file path in the metadata.
|
|
367
|
-
|
|
368
|
-
- `options`: [IOptions](#ioptions-interface) (optional)
|
|
369
|
-
|
|
370
|
-
An optional configuration object that specifies parsing options.
|
|
371
|
-
|
|
372
|
-
##### Returns
|
|
373
|
-
|
|
374
|
-
- `Promise<IAudioMetadata>`:
|
|
375
|
-
|
|
376
|
-
A promise that resolves to the metadata of the audio file.
|
|
377
|
-
|
|
378
|
-
##### Example
|
|
379
|
-
|
|
169
|
+
Example:
|
|
380
170
|
```js
|
|
381
|
-
|
|
171
|
+
const mm = require('music-metadata');
|
|
382
172
|
|
|
383
173
|
(async () => {
|
|
384
|
-
const fileInput = document.querySelector('input[type="file"]');
|
|
385
|
-
const file = fileInput.files[0];
|
|
386
|
-
|
|
387
174
|
try {
|
|
388
|
-
const metadata = await
|
|
175
|
+
const metadata = await mm.parseStream(someReadStream, {mimeType: 'audio/mpeg', size: 26838});
|
|
389
176
|
console.log(metadata);
|
|
390
177
|
} catch (error) {
|
|
391
|
-
console.error(
|
|
178
|
+
console.error(error.message);
|
|
392
179
|
}
|
|
393
180
|
})();
|
|
394
181
|
```
|
|
395
182
|
|
|
396
|
-
####
|
|
183
|
+
#### parseBuffer function
|
|
397
184
|
|
|
398
|
-
|
|
399
|
-
This function is particularly useful when you already have audio data in memory.
|
|
185
|
+
Parse metadata from an audio file, where the audio file is held in a [Buffer](https://nodejs.org/api/buffer.html).
|
|
400
186
|
|
|
401
|
-
##### Syntax
|
|
402
187
|
```ts
|
|
403
|
-
parseBuffer(buffer:
|
|
188
|
+
parseBuffer(buffer: Buffer, fileInfo?: IFileInfo | string, opts?: IOptions = {}): Promise<IAudioMetadata>
|
|
404
189
|
```
|
|
405
190
|
|
|
406
|
-
|
|
407
|
-
- `uint8Array`: [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)
|
|
408
|
-
|
|
409
|
-
A [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) containing the audio data to be parsed.
|
|
410
|
-
|
|
411
|
-
- `fileInfo`: `IFileInfo` | `string` (optional)
|
|
412
|
-
|
|
413
|
-
An object containing file information such as mimeType and size.
|
|
414
|
-
Alternatively, you can pass a MIME-type string directly.
|
|
415
|
-
This helps the parser understand the format of the audio data.
|
|
416
|
-
|
|
417
|
-
- `options`: [IOptions](#ioptions-interface) (optional)
|
|
418
|
-
|
|
419
|
-
An optional configuration object that specifies parsing options.
|
|
420
|
-
|
|
421
|
-
##### Returns
|
|
422
|
-
- `Promise<IAudioMetadata>`:
|
|
423
|
-
|
|
424
|
-
A promise that resolves to the metadata of the audio file.
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
##### Example
|
|
428
|
-
|
|
191
|
+
Example:
|
|
429
192
|
```js
|
|
430
|
-
import { parseBuffer } from 'music-metadata';
|
|
431
|
-
import fs from 'fs';
|
|
432
|
-
|
|
433
193
|
(async () => {
|
|
434
|
-
const buffer = fs.readFileSync('path/to/audio/file.mp3');
|
|
435
|
-
|
|
436
194
|
try {
|
|
437
|
-
const metadata =
|
|
195
|
+
const metadata = mm.parseBuffer(someBuffer, 'audio/mpeg');
|
|
438
196
|
console.log(metadata);
|
|
439
197
|
} catch (error) {
|
|
440
|
-
console.error(
|
|
198
|
+
console.error(error.message);
|
|
441
199
|
}
|
|
442
200
|
})();
|
|
443
201
|
```
|
|
444
202
|
|
|
445
|
-
####
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
such as parsing metadata from streaming audio or custom data sources.
|
|
203
|
+
#### parseFromTokenizer function
|
|
204
|
+
This is a low level function, reading from a [strtok3](https://github.com/Borewit/strtok3) ITokenizer interface.
|
|
205
|
+
[music-metadata-browser](https://github.com/Borewit/music-metadata-browser) is depended on this function.
|
|
449
206
|
|
|
450
207
|
This also enables special read modules like:
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
##### Syntax
|
|
454
|
-
```ts
|
|
455
|
-
parseFromTokenizer(tokenizer: ITokenizer, options?: IOptions): Promise<IAudioMetadata>
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
##### Parameters
|
|
459
|
-
- `tokenizer: ITokenizer`
|
|
460
|
-
|
|
461
|
-
An instance of an ITokenizer that provides access to the audio data.
|
|
462
|
-
The tokenizer abstracts the reading process, enabling support for various types of sources, including streams, buffers, or custom data readers.
|
|
463
|
-
|
|
464
|
-
- `options`: [IOptions](#ioptions-interface) (optional)
|
|
465
|
-
|
|
466
|
-
An optional configuration object that specifies parsing options.
|
|
467
|
-
|
|
468
|
-
##### Returns
|
|
469
|
-
- `Promise<IAudioMetadata>`:
|
|
470
|
-
|
|
471
|
-
A promise that resolves to the metadata of the audio source, including information like the title, artist, album, and more.
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
##### Example
|
|
475
|
-
````js
|
|
476
|
-
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
|
477
|
-
import { S3Client } from '@aws-sdk/client-s3';
|
|
478
|
-
import { makeTokenizer } from '@tokenizer/s3';
|
|
479
|
-
import { parseFromTokenizer as mmParseFromTokenizer } from 'music-metadata';
|
|
480
|
-
|
|
481
|
-
// Configure the S3 client
|
|
482
|
-
const s3 = new S3Client({
|
|
483
|
-
region: 'eu-west-2',
|
|
484
|
-
credentials: fromNodeProviderChain(),
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
// Helper function to create a tokenizer for S3 objects
|
|
488
|
-
async function makeS3TestDataTokenizer(key, options) {
|
|
489
|
-
return await makeTokenizer(s3, {
|
|
490
|
-
Bucket: 'music-metadata',
|
|
491
|
-
Key: key,
|
|
492
|
-
}, options);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
// Function to read and log metadata from an S3 object
|
|
496
|
-
async function readMetadata() {
|
|
497
|
-
try {
|
|
498
|
-
// Create a tokenizer for the specified S3 object
|
|
499
|
-
const tokenizer = await makeS3TestDataTokenizer('path/to/audio/file.mp3', { disableChunked: false });
|
|
500
|
-
|
|
501
|
-
// Parse the metadata from the tokenizer
|
|
502
|
-
const metadata = await mmParseFromTokenizer(tokenizer);
|
|
503
|
-
|
|
504
|
-
// Log the retrieved metadata
|
|
505
|
-
console.log(metadata);
|
|
506
|
-
} catch (error) {
|
|
507
|
-
console.error('Error parsing metadata:', error.message);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// Execute the metadata reading function
|
|
512
|
-
readMetadata();
|
|
513
|
-
````
|
|
514
|
-
##### Additional Resources
|
|
515
|
-
- [strtok3](https://github.com/Borewit/strtok3) - Learn more about the `ITokenizer` interface and how to implement it for various use cases.
|
|
516
|
-
- [AWS SDK for JavaScript](https://aws.amazon.com/sdk-for-javascript/) - Documentation on using the AWS SDK to interact with S3 and other AWS services.
|
|
517
|
-
- [@tokenizer/s3](https://github.com/Borewit/tokenizer-s3) - Example of `ITokenizer` implementation.
|
|
208
|
+
* [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).
|
|
518
209
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
`music-metadata` provides a robust and extensible error handling system with custom error classes that inherit from the standard JavaScript `Error`.
|
|
522
|
-
All possible parsing errors are part of a union type `UnionOfParseErrors`, ensuring that every error scenario is accounted for in your code.
|
|
523
|
-
|
|
524
|
-
#### Union of Parse Errors
|
|
525
|
-
|
|
526
|
-
All parsing errors extend from the base class `ParseError` and are included in the `UnionOfParseErrors` type:
|
|
527
|
-
```ts
|
|
528
|
-
export type UnionOfParseErrors =
|
|
529
|
-
| CouldNotDetermineFileTypeError
|
|
530
|
-
| UnsupportedFileTypeError
|
|
531
|
-
| UnexpectedFileContentError
|
|
532
|
-
| FieldDecodingError
|
|
533
|
-
| InternalParserError;
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
#### Error Types
|
|
537
|
-
|
|
538
|
-
- `CouldNotDetermineFileTypeError`: Raised when the file type cannot be determined.
|
|
539
|
-
- `UnsupportedFileTypeError`: Raised when an unsupported file type is encountered.
|
|
540
|
-
- `UnexpectedFileContentError`: Raised when the file content does not match the expected format.
|
|
541
|
-
- `FieldDecodingError`: Raised when a specific field in the file cannot be decoded.
|
|
542
|
-
- `InternalParserError`: Raised for internal parser errors.
|
|
543
|
-
|
|
544
|
-
### Other functions
|
|
545
|
-
|
|
546
|
-
#### `orderTags` function
|
|
210
|
+
#### orderTags function
|
|
547
211
|
|
|
548
212
|
Utility to Converts the native tags to a dictionary index on the tag identifier
|
|
549
213
|
|
|
@@ -551,29 +215,14 @@ Utility to Converts the native tags to a dictionary index on the tag identifier
|
|
|
551
215
|
orderTags(nativeTags: ITag[]): [tagId: string]: any[]
|
|
552
216
|
```
|
|
553
217
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
import { inspect } from 'util';
|
|
557
|
-
|
|
558
|
-
(async () => {
|
|
559
|
-
try {
|
|
560
|
-
const metadata = await parseFile('../test/samples/MusicBrainz - Beth Hart - Sinner\'s Prayer [id3v2.3].V2.mp3');
|
|
561
|
-
const orderedTags = orderTags(metadata.native['ID3v2.3']);
|
|
562
|
-
console.log(inspect(orderedTags, { showHidden: false, depth: null }));
|
|
563
|
-
} catch (error) {
|
|
564
|
-
console.error(error.message);
|
|
565
|
-
}
|
|
566
|
-
})();
|
|
567
|
-
```
|
|
568
|
-
|
|
569
|
-
#### `ratingToStars` function
|
|
570
|
-
|
|
218
|
+
#### ratingToStars function
|
|
219
|
+
|
|
571
220
|
Can be used to convert the normalized rating value to the 0..5 stars, where 0 an undefined rating, 1 the star the lowest rating and 5 the highest rating.
|
|
572
|
-
|
|
221
|
+
|
|
573
222
|
```ts
|
|
574
223
|
ratingToStars(rating: number): number
|
|
575
224
|
```
|
|
576
|
-
####
|
|
225
|
+
#### selectCover function
|
|
577
226
|
|
|
578
227
|
Select cover image based on image type field, otherwise the first picture in file.
|
|
579
228
|
|
|
@@ -582,125 +231,94 @@ export function selectCover(pictures?: IPicture[]): IPicture | null
|
|
|
582
231
|
```
|
|
583
232
|
|
|
584
233
|
```js
|
|
585
|
-
import
|
|
234
|
+
import * as mm from 'music-metadata';
|
|
586
235
|
|
|
587
236
|
(async () => {
|
|
588
|
-
const {common} = await parseFile(filePath);
|
|
589
|
-
const cover = selectCover(common.picture); // pick the cover image
|
|
237
|
+
const {common} = await mm.parseFile(filePath);
|
|
238
|
+
const cover = mm.selectCover(common.picture); // pick the cover image
|
|
590
239
|
}
|
|
591
240
|
)();
|
|
592
241
|
```
|
|
593
242
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
When `true`, the parser will read the entire media file _if necessary_ to determine the duration.
|
|
602
|
-
This is only applicable in cases where duration cannot be reliably inferred without full file analysis.
|
|
603
|
-
Note that enabling this option **does not guarantee** that duration will be available,
|
|
604
|
-
only that the parser will attempt to calculate it when possible, even if it requires reading the full file.
|
|
605
|
-
|
|
606
|
-
- `includeChapters`: `boolean` (default: `false`)
|
|
607
|
-
When `true`, the MP4 parser scans the `mdat` atom for chapters.
|
|
608
|
-
|
|
609
|
-
- `mkvUseIndex`: `boolean` (default: `false`)
|
|
610
|
-
|
|
611
|
-
When `true`, the parser uses the SeekHead index in Matroska (MKV) files to skip segment and cluster elements.
|
|
612
|
-
This experimental feature can improve performance, but:
|
|
613
|
-
- Metadata not listed in the SeekHead may be skipped.
|
|
614
|
-
- If the SeekHead is missing, this option has no effect.
|
|
243
|
+
### Options
|
|
244
|
+
* `duration`: default: `false`, if set to `true`, it will parse the whole media file if required to determine the duration.
|
|
245
|
+
* `observer: (update: MetadataEvent) => void;`: Will be called after each change to `common` (generic) tag, or `format` properties.
|
|
246
|
+
* `skipCovers`: default: `false`, if set to `true`, it will not return embedded cover-art (images).
|
|
247
|
+
* `skipPostHeaders? boolean` default: `false`, if set to `true`, it will not search all the entire track for additional headers. Only recommenced to use in combination with streams.
|
|
248
|
+
* `includeChapters` default: `false`, if set to `true`, it will parse chapters (currently only MP4 files). _experimental functionality_
|
|
615
249
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
- `skipCovers`: `boolean` (default: `false`)
|
|
622
|
-
|
|
623
|
-
When `true`, embedded cover art (images) will not be extracted.
|
|
624
|
-
Useful for reducing memory and processing when cover images are unnecessary.
|
|
625
|
-
|
|
626
|
-
- `skipPostHeaders`: `boolean` (default: `false`)
|
|
627
|
-
When `true`, tag headers located at the end of the file will not be read.
|
|
628
|
-
This is particularly beneficial for streaming input, as it avoids the need to read the entire stream.
|
|
629
|
-
|
|
630
|
-
> [!NOTE]
|
|
631
|
-
> - The `duration` option is typically included in most cases, but setting it to true ensures that the entire file is parsed if necessary to get an accurate duration.
|
|
632
|
-
> - Using `mkvUseIndex` can improve performance in Matroska files, but be aware of potential side effects, such as missing metadata due to skipped elements.
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
### `IAudioMetadata` interface
|
|
250
|
+
Although in most cases duration is included, in some cases it requires `music-metadata` parsing the entire file.
|
|
251
|
+
To enforce parsing the entire file if needed you should set `duration` to `true`.
|
|
252
|
+
|
|
253
|
+
### Metadata result
|
|
636
254
|
|
|
637
255
|
If the returned promise resolves, the metadata (TypeScript `IAudioMetadata` interface) contains:
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
256
|
+
* [`metadata.format`](#metadataformat) Audio format information
|
|
257
|
+
* [`metadata.common`](#metadatacommon) Is a generic (abstract) way of reading metadata information.
|
|
258
|
+
* [`metadata.trackInfo`](#metadatatrackInfo) Is a generic (abstract) way of reading metadata information.
|
|
259
|
+
* `metadata.native` List of native (original) tags found in the parsed audio file.
|
|
260
|
+
|
|
643
261
|
#### `metadata.format`
|
|
644
262
|
|
|
645
|
-
The questionmark `?` indicates the property is optional.
|
|
646
|
-
|
|
263
|
+
The questionmark `?` indicates the property is optional.
|
|
264
|
+
|
|
647
265
|
Audio format information. Defined in the TypeScript `IFormat` interface:
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
266
|
+
* `format.container?: string` Audio encoding format. e.g.: 'flac'
|
|
267
|
+
* `format.codec?` Name of the codec (algorithm used for the audio compression)
|
|
268
|
+
* `format.codecProfile?: string` Codec profile / settings
|
|
269
|
+
* `format.tagTypes?: TagType[]` List of tagging formats found in parsed audio file
|
|
270
|
+
* `format.duration?: number` Duration in seconds
|
|
271
|
+
* `format.bitrate?: number` Number bits per second of encoded audio file
|
|
272
|
+
* `format.sampleRate?: number` Sampling rate in Samples per second (S/s)
|
|
273
|
+
* `format.bitsPerSample?: number` Audio bit depth
|
|
274
|
+
* `format.lossless?: boolean` True if lossless, false for lossy encoding
|
|
275
|
+
* `format.numberOfChannels?: number` Number of audio channels
|
|
276
|
+
* `format.creationTime?: Date` Track creation time
|
|
277
|
+
* `format.modificationTime?: Date` Track modification / tag update time
|
|
278
|
+
* `format.trackGain?: number` Track gain in dB
|
|
279
|
+
* `format.albumGain?: number` Album gain in dB
|
|
662
280
|
|
|
663
281
|
#### `metadata.trackInfo`
|
|
664
282
|
|
|
665
|
-
To support advanced containers like [Matroska](https://wikipedia.org/wiki/Matroska) or [MPEG-4](https://en.wikipedia.org/wiki/MPEG-4), which may contain multiple audio and video tracks, the **experimental
|
|
666
|
-
|
|
283
|
+
To support advanced containers like [Matroska](https://wikipedia.org/wiki/Matroska) or [MPEG-4](https://en.wikipedia.org/wiki/MPEG-4), which may contain multiple audio and video tracks, the **experimental** `metadata.trackInfo` has been added,
|
|
284
|
+
|
|
667
285
|
`metadata.trackInfo` is either `undefined` or has an **array** of [trackInfo](#trackinfo)
|
|
668
|
-
|
|
286
|
+
|
|
669
287
|
##### trackInfo
|
|
670
|
-
|
|
288
|
+
|
|
671
289
|
Audio format information. Defined in the TypeScript `IFormat` interface:
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
290
|
+
* `trackInfo.type?: TrackType` Track type
|
|
291
|
+
* `trackInfo.codecName?: string` Codec name
|
|
292
|
+
* `trackInfo.codecSettings?: string` Codec settings
|
|
293
|
+
* `trackInfo.flagEnabled?: boolean` Set if the track is usable, default: `true`
|
|
294
|
+
* `trackInfo.flagDefault?: boolean` Set if that track (audio, video or subs) SHOULD be active if no language found matches the user preference.
|
|
295
|
+
* `trackInfo.flagLacing?: boolean` Set if the track **may** contain blocks using lacing
|
|
296
|
+
* `trackInfo.name?: string` A human-readable track name.
|
|
297
|
+
* `trackInfo.language?: string` Specifies the language of the track
|
|
298
|
+
* `trackInfo.audio?: IAudioTrack`, see [`trackInfo.audioTrack`](#trackinfoaudiotrack)
|
|
299
|
+
* `trackInfo.video?: IVideoTrack`, see [`trackInfo.videoTrack`](#trackinfovideotrack)
|
|
682
300
|
|
|
683
301
|
##### `trackInfo.audioTrack`
|
|
684
302
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
303
|
+
* `audioTrack.samplingFrequency?: number`
|
|
304
|
+
* `audioTrack.outputSamplingFrequency?: number`
|
|
305
|
+
* `audioTrack.channels?: number`
|
|
306
|
+
* `audioTrack.channelPositions?: Buffer`
|
|
307
|
+
* `audioTrack.bitDepth?: number`
|
|
690
308
|
|
|
691
309
|
##### `trackInfo.videoTrack`
|
|
692
310
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
311
|
+
* `videoTrack.flagInterlaced?: boolean`
|
|
312
|
+
* `videoTrack.stereoMode?: number`
|
|
313
|
+
* `videoTrack.pixelWidth?: number`
|
|
314
|
+
* `videoTrack.pixelHeight?: number`
|
|
315
|
+
* `videoTrack.displayWidth?: number`
|
|
316
|
+
* `videoTrack.displayHeight?: number`
|
|
317
|
+
* `videoTrack.displayUnit?: number`
|
|
318
|
+
* `videoTrack.aspectRatioType?: number`
|
|
319
|
+
* `videoTrack.colourSpace?: Buffer`
|
|
320
|
+
* `videoTrack.gammaValue?: number`
|
|
321
|
+
|
|
704
322
|
#### `metadata.common`
|
|
705
323
|
|
|
706
324
|
[Common tag documentation](doc/common_metadata.md) is automatically generated.
|
|
@@ -709,15 +327,11 @@ Audio format information. Defined in the TypeScript `IFormat` interface:
|
|
|
709
327
|
|
|
710
328
|
In order to read the duration of a stream (with the exception of file streams), in some cases you should pass the size of the file in bytes.
|
|
711
329
|
```js
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
(
|
|
716
|
-
|
|
717
|
-
console.log(inspect(metadata, {showHidden: false, depth: null}));
|
|
718
|
-
someReadStream.close();
|
|
719
|
-
}
|
|
720
|
-
)();
|
|
330
|
+
mm.parseStream(someReadStream, {mimeType: 'audio/mpeg', size: 26838}, {duration: true})
|
|
331
|
+
.then( function (metadata) {
|
|
332
|
+
console.log(util.inspect(metadata, {showHidden: false, depth: null}));
|
|
333
|
+
someReadStream.close();
|
|
334
|
+
});
|
|
721
335
|
```
|
|
722
336
|
|
|
723
337
|
### Access cover art
|
|
@@ -751,128 +365,70 @@ export interface IPicture {
|
|
|
751
365
|
|
|
752
366
|
To assign `img` HTML-object you can do something like:
|
|
753
367
|
```js
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
img.src = `data:${picture.format};base64,${uint8ArrayToBase64(picture.data)}`;
|
|
757
|
-
```
|
|
758
|
-
|
|
759
|
-
## Dependencies
|
|
760
|
-
|
|
761
|
-
Dependency diagram:
|
|
762
|
-
```mermaid
|
|
763
|
-
graph TD;
|
|
764
|
-
MMN("music-metadata (Node.js entry point)")-->MMP
|
|
765
|
-
MMN-->FTN
|
|
766
|
-
MMP("music-metadata (primary entry point)")-->S(strtok3)
|
|
767
|
-
MMP-->TY(token-types)
|
|
768
|
-
MMP-->FTP
|
|
769
|
-
MMP-->UAE
|
|
770
|
-
FTN("file-type (Node.js entry point)")-->FTP
|
|
771
|
-
FTP("file-type (primary entry point)")-->S
|
|
772
|
-
S(strtok3)-->TO("@tokenizer/token")
|
|
773
|
-
TY(token-types)-->TO
|
|
774
|
-
TY-->IE("ieee754")
|
|
775
|
-
FTP-->TY
|
|
776
|
-
NS("node:stream")
|
|
777
|
-
FTN-->NS
|
|
778
|
-
FTP-->UAE(uint8array-extras)
|
|
779
|
-
style NS fill:#F88,stroke:#A44
|
|
780
|
-
style IE fill:#CCC,stroke:#888
|
|
781
|
-
style FTN fill:#FAA,stroke:#A44
|
|
782
|
-
style MMN fill:#FAA,stroke:#A44
|
|
783
|
-
```
|
|
784
|
-
|
|
785
|
-
Dependency list:
|
|
786
|
-
- [tokenizer-token](https://github.com/Borewit/tokenizer-token)
|
|
787
|
-
- [strtok3](https://github.com/Borewit/strtok3)
|
|
788
|
-
- [token-types](https://github.com/Borewit/token-types)
|
|
789
|
-
- [file-type](https://github.com/sindresorhus/file-type)
|
|
790
|
-
- [@tokenizer-token](https://github.com/Borewit/tokenizer-token)
|
|
791
|
-
|
|
792
|
-
## CommonJS backward compatibility
|
|
793
|
-
|
|
794
|
-
Using Node.js ≥ 22, which is support loading ESM module via require
|
|
795
|
-
```js
|
|
796
|
-
const mm = require('music-metadata');
|
|
797
|
-
```
|
|
798
|
-
|
|
799
|
-
For older Node.js version < 22, you need to dynamically import **music-metadata**:
|
|
800
|
-
```js
|
|
801
|
-
(async () => {
|
|
802
|
-
// Dynamically loads the ESM module in a CommonJS project
|
|
803
|
-
const mm = await import('music-metadata');
|
|
804
|
-
})();
|
|
368
|
+
img.src = `data:${picture.format};base64,${picture.data.toString('base64')}`;
|
|
805
369
|
```
|
|
806
370
|
|
|
807
|
-
For CommonJS TypeScript projects, I recommend to avoid using `commonjs` for the TypeScript compiler `module` option,
|
|
808
|
-
and either use `node16` or `nodenext`, which enable utilizing [dynamic import](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/import).
|
|
809
|
-
|
|
810
|
-
If you do want to use the classic `commonjs` option, this is how you can get the _dynamic import_ to work.
|
|
811
|
-
|
|
812
|
-
```js
|
|
813
|
-
import {loadEsm} from 'load-esm';
|
|
814
|
-
|
|
815
|
-
(async () => {
|
|
816
|
-
// Dynamically loads the ESM module in a CommonJS project
|
|
817
|
-
const mm = await loadEsm<typeof import('music-metadata')>('music-metadata');
|
|
818
|
-
})();
|
|
819
|
-
```
|
|
820
|
-
|
|
821
|
-
When you use Node.js version ≥ 22, which supports loading ESM modules via require, this compensates for that issue.
|
|
822
|
-
|
|
823
371
|
## Frequently Asked Questions
|
|
824
372
|
|
|
825
|
-
|
|
373
|
+
1. How can I traverse (a long) list of files?
|
|
374
|
+
|
|
375
|
+
What is important that file parsing should be done in a sequential manner.
|
|
376
|
+
In a plain loop, due to the asynchronous character (like most JavaScript functions), it would cause all the files to run in parallel which is will cause your application to hang in no time.
|
|
377
|
+
There are multiple ways of achieving this:
|
|
378
|
+
|
|
379
|
+
1. Using recursion
|
|
380
|
+
|
|
381
|
+
```js
|
|
382
|
+
const mm = require('music-metadata')
|
|
383
|
+
|
|
384
|
+
function parseFiles(audioFiles) {
|
|
385
|
+
|
|
386
|
+
const audioFile = audioFiles.shift();
|
|
387
|
+
|
|
388
|
+
if (audioFile) {
|
|
389
|
+
return mm.parseFile(audioFile).then(metadata => {
|
|
390
|
+
// Do great things with the metadata
|
|
391
|
+
return parseFiles(audioFiles); // process rest of the files AFTER we are finished
|
|
392
|
+
})
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return Promise.resolve();
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
2. Use async/await
|
|
401
|
+
|
|
402
|
+
Use [async/await](https://javascript.info/async-await)
|
|
403
|
+
|
|
404
|
+
```js
|
|
405
|
+
const mm = require('music-metadata');
|
|
406
|
+
|
|
407
|
+
// it is required to declare the function 'async' to allow the use of await
|
|
408
|
+
async function parseFiles(audioFiles) {
|
|
409
|
+
|
|
410
|
+
for (const audioFile of audioFiles) {
|
|
411
|
+
|
|
412
|
+
// await will ensure the metadata parsing is completed before we move on to the next file
|
|
413
|
+
const metadata = await mm.parseFile(audioFile);
|
|
414
|
+
// Do great things with the metadata
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
3. Use a specialized module to traverse files
|
|
420
|
+
|
|
421
|
+
There are specialized modules to traversing (walking) files and directory,
|
|
422
|
+
like [walk](https://www.npmjs.com/package/walk).
|
|
826
423
|
|
|
827
|
-
|
|
828
|
-
In a plain loop, due to the asynchronous character (like most JavaScript functions), it would cause all the files to run in parallel which is will cause your application to hang in no time.
|
|
829
|
-
There are multiple ways of achieving this:
|
|
830
|
-
|
|
831
|
-
1. Using recursion
|
|
832
|
-
|
|
833
|
-
```js
|
|
834
|
-
import { parseFile } from 'music-metadata';
|
|
835
|
-
|
|
836
|
-
function parseFiles(audioFiles) {
|
|
837
|
-
|
|
838
|
-
const audioFile = audioFiles.shift();
|
|
839
|
-
|
|
840
|
-
if (audioFile) {
|
|
841
|
-
return parseFile(audioFile).then(metadata => {
|
|
842
|
-
// Do great things with the metadata
|
|
843
|
-
return parseFiles(audioFiles); // process rest of the files AFTER we are finished
|
|
844
|
-
})
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
```
|
|
849
|
-
|
|
850
|
-
1. Use async/await
|
|
851
|
-
|
|
852
|
-
Use [async/await](https://javascript.info/async-await)
|
|
853
|
-
|
|
854
|
-
```js
|
|
855
|
-
import { parseFile } from 'music-metadata';
|
|
856
|
-
|
|
857
|
-
// it is required to declare the function 'async' to allow the use of await
|
|
858
|
-
async function parseFiles(audioFiles) {
|
|
859
|
-
|
|
860
|
-
for (const audioFile of audioFiles) {
|
|
861
|
-
|
|
862
|
-
// await will ensure the metadata parsing is completed before we move on to the next file
|
|
863
|
-
const metadata = await parseFile(audioFile);
|
|
864
|
-
// Do great things with the metadata
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
```
|
|
424
|
+
## Licence
|
|
868
425
|
|
|
869
|
-
|
|
426
|
+
The MIT License (MIT)
|
|
870
427
|
|
|
871
|
-
|
|
872
|
-
is set to `"bundler"`, it does not set the ECMAScript `"node"` condition, causing the Node specific function fail to import.
|
|
428
|
+
Copyright © 2022 Borewit
|
|
873
429
|
|
|
874
|
-
|
|
430
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
875
431
|
|
|
876
|
-
|
|
432
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
877
433
|
|
|
878
|
-
|
|
434
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|