mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Defintions for musicmetadata package (#10841)
* Add Music Metadata * Fix some errors
This commit is contained in:
committed by
Masahiro Wakame
parent
c9848c3240
commit
ff8b4983fa
@@ -0,0 +1,10 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="./musicmetadata.d.ts" />
|
||||
|
||||
import * as fs from "fs";
|
||||
import * as mm from "musicmetadata";
|
||||
|
||||
mm(fs.createReadStream("hype-train.mp3"), (err: Error, metadata: MM.Metadata) => {
|
||||
if (err) throw err;
|
||||
console.log(`Parsed song ${metadata.title}`);
|
||||
});
|
||||
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
// Type definitions for musicmetadata 2.0.4
|
||||
// Project: https://www.npmjs.com/package/musicmetadata
|
||||
// Definitions by: Xavier Stouder <https://github.com/Xstoudi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "musicmetadata" {
|
||||
import {Readable} from "stream";
|
||||
import {EventEmitter} from "events";
|
||||
|
||||
function mm(readStream: Readable, callback: (err: Error, metadata: MM.Metadata) => void): EventEmitter;
|
||||
function mm(readStream: Readable, options: MM.Options, callback: (err: Error, metadata: MM.Metadata) => void): EventEmitter;
|
||||
|
||||
namespace mm { }
|
||||
|
||||
export = mm;
|
||||
}
|
||||
|
||||
declare namespace MM {
|
||||
export interface Options {
|
||||
duration: boolean;
|
||||
fileSize: number;
|
||||
}
|
||||
|
||||
export interface Metadata {
|
||||
artist: string[];
|
||||
album: string;
|
||||
albumartist: string[];
|
||||
title: string;
|
||||
year: string;
|
||||
track: NoOf;
|
||||
disk: NoOf;
|
||||
genre: string;
|
||||
picture: Picture[];
|
||||
duration: number;
|
||||
}
|
||||
|
||||
export interface NoOf {
|
||||
no: number;
|
||||
of: number;
|
||||
}
|
||||
|
||||
export interface Picture {
|
||||
format: string;
|
||||
data: Buffer;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user