import * as Stream from 'stream' ; import * as strtok3 from 'strtok3' ; import * as Core from './core' ; import { ParserFactory } from './ParserFactory' ; import { IAudioMetadata , IOptions } from './type' ; import * as _debug from 'debug' ; import { RandomFileReader } from './common/RandomFileReader' ; export { IAudioMetadata , IOptions , ITag , INativeTagDict , ICommonTagsResult , IFormat , IPicture , IRatio , IChapter } from './type' ; const debug = _debug ( "music-metadata:parser" ) ; export { parseFromTokenizer , parseBuffer , IFileInfo , selectCover } from './core' ; param stream param fileInfo param options returns export async function parseStream ( stream , fileInfo ? , options = { } ) { const tokenizer = await strtok3 . fromStream ( stream , typeof fileInfo === 'string' ? { mimeType : fileInfo } : fileInfo ) ; return Core . parseFromTokenizer ( tokenizer , options ) ; } param filePath param options returns export async function parseFile ( filePath , options = { } ) { debug ( `parseFile: ${ filePath }` ) ; const fileTokenizer = await strtok3 . fromFile ( filePath ) ; const fileReader = new RandomFileReader ( filePath , fileTokenizer . fileInfo . size ) ; try { await Core . scanAppendingHeaders ( fileReader , options ) ; } finally { fileReader . close ( ) ; } try { const parserName = ParserFactory . getParserIdForExtension ( filePath ) ; if ( ! parserName ) debug ( ' Parser could not be determined by file extension' ) ; return await ParserFactory . parse ( fileTokenizer , parserName , options ) ; } finally { await fileTokenizer . close ( ) ; } } param nativeTags returns export const orderTags = Core . orderTags ; param rating returns export const ratingToStars = Core . ratingToStars ; /**
 * Define default module exports
 */ export default { parseStream , parseFile , parseFromTokenizer : Core . parseFromTokenizer , parseBuffer : Core . parseBuffer , selectCover : Core . selectCover } ;