We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm supposed to supply my own function here...
Can you provide an example of what that what that would look like?
I definitely appreciate this library! It's challenging to find a Typescript version - I'm using NestJS for my server
This is how I'm trying to plug it into NestJS - it seems solid except I'm missing yourCustomLogic
yourCustomLogic
import * as multer from 'multer'; import { MulterAzureStorage, MASNameResolver } from 'multer-azure-blob-storage'; const resolveBlobName: MASNameResolver = ( req: any, file: Express.Multer.File, ): Promise<string> => { return new Promise<string>((resolve, reject) => { const blobName: string = yourCustomLogic(req, file); resolve(blobName); }); }; export type MetadataObj = { [k: string]: string }; const resolveMetadata: MASObjectResolver = ( req: any, file: Express.Multer.File, ): Promise<MetadataObj> => { return new Promise<MetadataObj>((resolve, reject) => { const metadata: MetadataObj = yourCustomLogic(req, file); resolve(metadata); }); }; const resolveContentSettings: MASObjectResolver = ( req: any, file: Express.Multer.File, ): Promise<MetadataObj> => { return new Promise<MetadataObj>((resolve, reject) => { const contentSettings: MetadataObj = yourCustomLogic(req, file); resolve(contentSettings); }); }; const azureStorage: MulterAzureStorage = new MulterAzureStorage({ connectionString: CONNECTION_STRING, accessKey: ACCESS_KEY, accountName: ACCOUNT_NAME, containerName: 'documents', blobName: resolveBlobName, metadata: resolveMetadata, contentSettings: resolveContentSettings, containerAccessLevel: 'blob', urlExpirationTime: 60, }); const upload: multer.Instance = multer({ storage: azureStorage, }); @Injectable() export class PhotoUploadService { async fileupload(@Req() req, @Res() res) { try { upload(req, res, function(error) { if (error) { console.log('attempting upload ERROR: ', error); return res.status(404).json(`Failed to upload image file: ${error}`); } if (req.files) { //console.log("attempting upload ok: ", req.files); return res.status(201).json(req.files[0].location); } else { console.log('attempting upload ERROR! no files!!!'); return res .status(404) .json(`Failed to upload image file: the request had no files`); } }); } catch (error) { console.log(error); return res.status(500).json(`Failed to upload image file: ${error}`); } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm supposed to supply my own function here...
Can you provide an example of what that what that would look like?
I definitely appreciate this library! It's challenging to find a Typescript version - I'm using NestJS for my server
This is how I'm trying to plug it into NestJS - it seems solid except I'm missing
yourCustomLogic
The text was updated successfully, but these errors were encountered: