How can I do Base64 encoding in Node.js?

Buffers can be used for taking a string or piece of data and doing Base64 encoding of the result. For example: > console.log(Buffer.from(“Hello World”).toString(‘base64’)); SGVsbG8gV29ybGQ= > console.log(Buffer.from(“SGVsbG8gV29ybGQ=”, ‘base64’).toString(‘ascii’)) Hello World Buffers are a global object, so no require is needed. Buffers created with strings can take an optional encoding parameter to specify what encoding the … Read more

When are you supposed to use escape instead of encodeURI / encodeURIComponent?

escape() Don’t use it! escape() is defined in section B.2.1.2 escape and the introduction text of Annex B says: … All of the language features and behaviours specified in this annex have one or more undesirable characteristics and in the absence of legacy usage would be removed from this specification. … … Programmers should not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)