import multer from 'multer' ; import path from 'path' ; import crypto from 'crypto' ; export default { storage : multer . diskStorage ( { destination : path . resolve ( __dirname , '..' , '..' , 'uploads' ) , filename ( request , file , calback ) { const hash = crypto . randomBytes ( 6 ) . toString ( 'hex' ) ; const fileName = `${ hash }-${ file . originalname }` ; calback ( null , fileName ) ; } } ) } ;