I am trying to do base64 encode in NodeJS using TypeScript.
Following code working fine in JavaScript.
When I am writing same thing in TypeScript and compil
Buffer is from Node namespace. First install
npm install --save @types/node
then add below code to your tsconfig.json file inside the compilerOptions section
"types": ["node"],
"typeRoots": ["node_modules/@types"]
The typeRoots entry specifies a list of directories for type definition files to be included. It requires TypeScript version 2.0 or later.