dirname and filename in nodejs es6 module
In Node.js with ES6 modules, you can use the import.meta.url to get the current file's URL, and then use the URL module to extract the directory name and file name.…
In Node.js with ES6 modules, you can use the import.meta.url to get the current file's URL, and then use the URL module to extract the directory name and file name.…
Mongoose schemas support a timestamps option. If you set timestamps: true, Mongoose will add two properties of type Date to your schema: createdAt: a date representing when this document was createdupdatedAt: a date representing when…
This means that a promise you called rejected, but there was no catch used to handle the error. Add a catch after the offending then to handle this properly. The origin of this error lies in…
The error is because of the new version of the mongoose i.e version 6.0.6. useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options. Mongoose 6 always behaves as if useNewUrlParser, useUnifiedTopology, and useCreateIndex are true, and useFindAndModify is false. Please remove…
The btoa() function takes a JavaScript string as a parameter. In JavaScript strings are represented using the UTF-16 character encoding: in this encoding, strings are represented as a sequence of 16-bit (2…
Using NodeJS we can create ssh connection to send file or executing any command on Linux based server. Here we are using npm module ssh2 for sftp connection to transfer…