- Getting Started
- Browser Support
- Languages Support
- Shortcuts
- Activation
- Examples
- Customize the Editor
- Use-cases
- Plugins
- APIs
- Development Frameworks
- Server Integrations
- Server SDKs
- Migration Guides
- Changelog
- Tutorials
Node.JS SDK File Reference
upload (req, fileRoute, options, callback)
Method used to upload a file to the specified location on disk.
Parameters:
-
req
In Node.JS, the uploaded file is available in the request received by your application.
Type: Request Object
-
fileRoute
The path of the file is relative to the root of your application.
Type: String
-
options
This parameter is optional. Use it to pass custom options for the file upload.
Type: Object
-
callback
A callback function call when the
upload
method finishes, or an error occurs. Invoked with (err, data).Type: Function
options parameter:
-
fieldname
The field name from the request object.
Type: String Default: "file"
-
validation
A Javascript Object or a function used to validate the uploaded image. The Javascript Object specifies the allowed image extensions through
allowedExts
and the allowed mime types throughallowedMimeTypes
. The function should be invoked with:filePath
,mimetype
, andcallback
.Type: Object or Function Default: { 'allowedExts': ['gif', 'jpeg', 'jpg', 'png', 'svg', 'blob'], 'allowedMimeTypes': ['image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/svg+xml'] }
delete (src, callback)
Method used to delete a file from disk.
Parameters:
-
src
The file path available in the body of the request:
request.body.src
.Type: String
-
callback
A callback function called when the
delete
method finishes, or an error occurs. Invoked with (err, data).Type: Function
Do you think we can improve this article? Let us know.