npm: TerserFlow

node v10.24.1
version: 2.1.0
endpointsharetweet
Method 1 - Promise
// Method 1 - Promise const tf = require("terserflow") // https://www.npmjs.com/package/terserflow let codeToBeObfuscated = `function printMsg(msg) {console.log("This is a message from the obfuscated printMsg function : " + msg)}`; let extraSecurity = true; // This is passed into the obfuscate method below let resolvedPromise =tf.obfuscate(codeToBeObfuscated, extraSecurity); // extraSecurity is optional and false by default ^^^^^^ resolvedPromise.then((obfuscated) => { console.log(obfuscated); //Do whatever you want with the variable obfuscated here for example write it to a file }).catch((error) => {console.error(error);});
Method 2 - async and await
// Method 2 - async and await const tf = require("terserflow") // https://www.npmjs.com/package/terserflow async function obfuscateAndDoSomething(code) { let extraSecurity = true; // This is passed into the obfuscate method below let obfuscated = await tf.obfuscate(code, extraSecurity); // extraSecurity is optional and false by default ^^^^ console.log(obfuscated); //Do whatever you want with the variable obfuscated here for example write it to a file } obfuscateAndDoSomething("alert('Help');");
Created from: https://npm.runkit.com/terserflow
Loading…

no comments

    sign in to comment