code-protect

2019-07-12 admin

code-protect是什么

什么是code-protect,It's a module which convert your JavaScript code into some not understandable format and still it's executable.This module can be used to protect the code base which run's on browser's client side or we can protect the nodejs code base as well.

code-protect使用教程帮助文档

Code Protect

It’s a module which convert your JavaScript code into some not understandable format and still it’s executable. This module can be used to protect the code base which run’s on browser’s client side or we can protect the NodeJs code base as well. We have to mention the few options provided where sourceDir is mandatory field. Just mention the root path in this field and code-protect converts all the .js files present in sub-folder.

Module Usage

Install

npm install code-protect --save

Usage

Module Require:

var codeProtect = require('code-protect');

Options: sourceDir is a mandatory field

var option = {
    sourceDir: './sample-codebase',
    destinationDir: './new-sample-codebase',
    uglify:true,
    debug: true
};

Method Use:

codeProtect(option, function (err, data) {
    if (err) {
        throw err;
    } else {
        doSomething......
    }
});

JavaScript Sample Code:

var codeProtect = require('code-protect');
var option = {
    sourceDir: './sample-codebase',
    destinationDir: './new-sample-codebase',
    uglify:true,
    debug: true
};

codeProtect(option, function (err, data) {
    if (err) {
        throw err;
    } else {
        console.log(data);
    }
});

Command Usage

Install

npm install code-protect -g

Usage

Usage: code-protect [options] -s Warning: By Default destination directory set as source directory path.

Options:

  • -h, --help,                                      output usage information
    
    
  • -V, --version,                                   output the version number
    
    
  • -s, --source <source-directory-path>,            mention the source directory path.
    
    
  • -d, --destination <destination-directory-path>,  mention destination directory path.
    
    
  • -u, --uglify <true/false>,                       uglification on files
    
    
  • -x, --debug <true/false>,                        debug mode
    
    

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-69568.html

文章标题:code-protect

回到顶部