Media addMedia method
This commit is contained in:
@ -19,13 +19,17 @@ export class Media {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public addMedia(key: string, filePath: string): void {
|
public addMedia(filePath: string): IMediaData {
|
||||||
this.map.set(key, {
|
const key = path.basename(filePath);
|
||||||
|
const imageData = {
|
||||||
referenceId: this.map.values.length,
|
referenceId: this.map.values.length,
|
||||||
stream: fs.createReadStream(filePath),
|
stream: fs.createReadStream(filePath),
|
||||||
path: filePath,
|
path: filePath,
|
||||||
fileName: path.basename(filePath),
|
fileName: key,
|
||||||
});
|
};
|
||||||
|
this.map.set(key, imageData);
|
||||||
|
|
||||||
|
return imageData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get array(): IMediaData[] {
|
public get array(): IMediaData[] {
|
||||||
|
Reference in New Issue
Block a user