Media addMedia method

This commit is contained in:
Dolan
2018-01-09 21:57:10 +00:00
parent 2adde9830c
commit a3945bc7f1

View File

@ -19,13 +19,17 @@ export class Media {
return data;
}
public addMedia(key: string, filePath: string): void {
this.map.set(key, {
public addMedia(filePath: string): IMediaData {
const key = path.basename(filePath);
const imageData = {
referenceId: this.map.values.length,
stream: fs.createReadStream(filePath),
path: filePath,
fileName: path.basename(filePath),
});
fileName: key,
};
this.map.set(key, imageData);
return imageData;
}
public get array(): IMediaData[] {