Skip to content

docs: add JSDoc to the public API - #1467

Open
UlisesGascon wants to merge 1 commit into
mainfrom
docs/jsdoc-public-api
Open

docs: add JSDoc to the public API#1467
UlisesGascon wants to merge 1 commit into
mainfrom
docs/jsdoc-public-api

Conversation

@UlisesGascon

Copy link
Copy Markdown
Member

Adds JSDoc to the public surface: multer(options) with the current option set (dest/storage, fileFilter, limits incl. fieldNestingDepth and fieldArrayIndexLimit, preservePath, defParamCharset), .single/.array/.fields/.none/.any, diskStorage/memoryStorage, the storage-engine contract and MulterError (code, field, filename, list of codes). Internals are left as they are.

Supersedes #1284, which documented the 2.0 code and needed a rewrite after 2.3.0; its author is credited as co-author.

Closes #1284
Closes #1283

Document multer(options), the middleware methods, the storage engines
and MulterError, including the options and error codes added in 2.3.0.

Co-authored-by: Arham Sayyed <arhamsayyed56@gmail.com>
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 99.724%. remained the same — docs/jsdoc-public-api into main

@UlisesGascon UlisesGascon mentioned this pull request Aug 29, 2026
5 tasks

@kilisamemarisaaa kilisamemarisaaa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The File typedef does not match the object passed to the two public callbacks that reference it. File.size is currently required and stream is absent, but fileFilter runs before either property exists, and StorageEngine._handleFile receives file.stream while size is still absent.

I verified the lifecycle with a custom storage engine on the current implementation:

fileFilter:  stream=false, size=false
_handleFile: stream=true,  size=false
req.file:    stream=false, size=true

This also conflicts with the _handleFile description here ("Consumes file.stream") and with StorageEngine.md, while editor/type consumers would report the real storage-engine API as missing. Could the callback inputs use stage-specific typedefs (for example a base incoming file plus a storage file with stream), or otherwise make size optional and declare stream for the _handleFile parameter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Code Documentation for Enhanced IntelliSense Support

4 participants