The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/apps/server/bridges/uploads.js

27 lines
612 B

import { FileUpload } from '../../../file-upload/server';
export class AppUploadBridge {
constructor(orch) {
this.orch = orch;
}
async getById(id, appId) {
this.orch.debugLog(`The App ${ appId } is getting the upload: "${ id }"`);
return this.orch.getConverters().get('uploads').convertById(id);
}
getBuffer(upload, appId) {
this.orch.debugLog(`The App ${ appId } is getting the upload: "${ upload.id }"`);
return new Promise((resolve, reject) => {
FileUpload.getBuffer(upload, (error, result) => {
if (error) {
return reject(error);
}
resolve(result);
});
});
}
}