導航:首頁 > 文件處理 > js解壓工具

js解壓工具

發布時間:2022-01-17 21:38:48

壓縮後的JS代碼怎樣解壓

一般壓縮都經過混淆,如果你看到變數名都是A,B,C,D之類的無規則的命名,那就是被混淆過的,一般來說也很難閱讀,就算你 還原了格式。

如果是沒有混淆的,你可以試試用js的格式化工具來重新格式化一下的,比如:
/* 美化:格式化代碼,使之容易閱讀 */
/* 凈化:去掉代碼中多餘的注釋、換行、空格等 */
/* 壓縮:將代碼壓縮為更小體積,便於傳輸 */
/* 解壓:將壓縮後的代碼轉換為人可以閱讀的格式 */
/* 混淆:將代碼的中變數名簡短化以減小體積,但可讀性差,經混淆後的代碼無法還原 */

/* 如果有用,請別忘了推薦給你的朋友: */
/* javascript在線美化、凈化、壓縮、解壓:http://tool.lu/js */

/* 以下是演示代碼 */
var Inote = {};
Inote.JSTool = function(options) {
this.options = options || {};
};
Inote.JSTool.prototype = {
_name: 'Javascript工具',
_history: {
'v1.0': ['2011-01-18', 'javascript工具上線'],
'v1.1': ['2012-03-23', '增加混淆功能'],
'v1.2': ['2012-07-21', '升級美化功能引擎'],
'v1.3': ['2014-03-01', '升級解密功能,支持eval,window.eval,window["eval"]等的解密'],
'v1.4': ['2014-08-05', '升級混淆功能引擎'],
'v1.5': ['2014-08-09', '升級js壓縮引擎'],
'v1.6': ['2015-04-11', '升級js混淆引擎']
},
options: {},
getName: function() {return this._name;},
getHistory: function() {
return this._history;}
};
var jstool = new Inote.JSTool();

㈡ node.js同步怎麼解壓文件

搜到一個只能解壓縮的 https://github.com/nearinfinity/node-unzip
fs.createReadStream('path/to/archive.zip').pipe(unzip.Extract({ path: 'output/path' }));
var readStream = fs.createReadStream('path/to/archive.zip');var writeStream = fstream.Writer('output/path');fs.createReadStream('path/to/archive.zip')
.pipe(unzip.Parse())
.on('entry', function (entry) {
var fileName = entry.path;
var type = entry.type; // 'Directory' or 'File'
var size = entry.size;

//process the entry or pipe it to another stream
...
});

㈢ 哪位有js代碼壓縮工具,跪求,好用追加

不必那麼麻煩,網路「js代碼壓縮」,有現成的工具,JQuery官方,和一些第三方的都有,你把代碼粘貼上,選擇你要的設置,就可以完成壓縮。

㈣ 誰有JavaScript壓縮工具 好用的 給我一份

給你我自己用的代碼吧~~~
package com.wanghe;
import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
* 腳本處理類
* 1.實現壓縮單個js文件--去除注釋換行和多個空格,最終輸出一行字元串
* 2.實現批量js壓縮功能,壓縮目錄下的所有js文件到對應的輸出目錄下
* 3.實現js合並功能 根據需要壓縮的列表和輸出文件路徑及是否壓縮生成對應文件
* @author zheng
* @version 1.0
*/
public class ScriptHelp
{
private static final String ENCODE = "GBK";

public static void main(String[] args)
{
//批量壓縮js文件
String baseScriptPath = "D:/easy-tab.js";
String miniScriptPath = "D:/mini/easy-tab-mini.js";
//batchCompressJS(baseScriptPath,miniScriptPath);
compressSingleJS(baseScriptPath,miniScriptPath);
//壓縮單個js文件
//compressSingleJS("D:/workspace/coos/WebRoot/scripts/coos.js","D:/workspace/coos/WebRoot/scripts/mini/coos.js");
/*
//合並js文件
List<String> fileList = new ArrayList<String>();
fileList.add("D:/workspace/coos/WebRoot/scripts/coos.js");
fileList.add("D:/workspace/coos/WebRoot/scripts/coos.extend.ajax.js");
String toFile = "D:/workspace/coos/WebRoot/scripts/mini/coos.js";
mergeJS(fileList,toFile,true);
*/
}
/**
* 批量壓縮js,壓縮當前目錄下的所有js
* @param baseScriptPath 要壓縮的文件目錄
* @param miniScriptPath 輸出壓縮後對應的目錄
*/
@SuppressWarnings("unchecked")
public static void batchCompressJS(String baseScriptPath,String miniScriptPath)
{
//獲取當前目錄下所以js文件路徑(不包括子目錄)
List fileList = getListFiles(baseScriptPath,"js",false);

for (Iterator i = fileList.iterator(); i.hasNext();)
{
String fromFile = (String) i.next();
String toFile = miniScriptPath +fromFile.substring(fromFile.lastIndexOf("/"), fromFile.length());
compressSingleJS(fromFile,toFile);
}
}

/**
* 壓縮單個js文件
* @param fromFile
* @param toFile
*/
public static void compressSingleJS(String fromFile,String toFile)
{
String content = readFile(fromFile);
writeFile(compressJS(content),toFile);
}
/**
* 合並js文件
* @param fileList 文件全路徑的list,需要按順序
* @param toFile 輸出文件的全路徑
* @param isCompress 是否壓縮
*
*/
@SuppressWarnings("unchecked")
public static void mergeJS(List fileList,String toFile,Boolean isCompress)
{
String content = "";
for (Iterator i = fileList.iterator(); i.hasNext();)
{
String fromFile = (String) i.next();
content += readFile(fromFile);
}
if(isCompress == true)
writeFile(compressJS(content),toFile);
else
writeFile(content,toFile);
}
/**
* 去除注釋、多個空格和換行,最終形成一行的字元串
* @param content 要壓縮的內容
* @return 壓縮後的內容
*/
public static String compressJS(String content)
{
//去掉/*some code*/的注釋 注意alert()里不要有/**/
content = content.replaceAll("//.*[\\r\\n]","");
//去掉/*some code*/的注釋 注意alert()里不要有/**/
content = content.replaceAll("\\/\\*(a|[^a])*?\\*\\/","");
/*多餘的空格*/
content = content.replaceAll("\\s{2,}"," ");
//等號兩邊的空格去掉
content = content.replaceAll("\\s*=\\s*","=");
//}兩邊的空格去掉
content = content.replaceAll("\\s*}\\s*","}");
//{兩邊的空格去掉
content = content.replaceAll("\\s*\\{\\s*","\\{");
//冒號兩邊的空格去掉
content = content.replaceAll("\\s*:\\s*",":");
//逗號兩邊的空格去掉
content = content.replaceAll("\\s*,\\s*",",");
//分號兩邊的空格去掉
content = content.replaceAll("\\s*;\\s*",";");
//與兩邊的空格去掉
content = content.replaceAll("\\s*&&\\s*","&&");
//或兩邊的空格去掉
content = content.replaceAll("\\s*\\|\\|\\s*","\\|\\|");
/*替換換行和回車*/
content = content.replaceAll("\\r\\n","").replaceAll("\\n", "");
return content;
}
/**
* 輸出文件,編碼為UTF-8 用記事本另存為:fileContent 全部為英文則為ansi 包含中文則為UTF-8
* @param content 要輸出的文件內容
* @param comspec 全路徑名
*/
public static void writeFile(String content,String comspec)
{
try
{
int i = comspec.lastIndexOf("/");
String dirs = comspec.substring(0,i);
File file = new File(dirs);
if(!file.exists()){
file.mkdir();
}
file = new File(comspec);
if(!file.exists()){
file.createNewFile();
}
FileOutputStream fos = new FileOutputStream(file);
Writer out = new OutputStreamWriter(fos,ENCODE);
out.write(content);
System.out.println("成功輸出文件:" + comspec);
out.close();
fos.close();
} catch (IOException e)
{
System.out.println("寫文件操作出錯!");
e.printStackTrace();
}
}

/**
* 讀取文件內容
* @param filePath
* @return String
*/
public static String readFile(String filePath)
{
StringBuilder sb = new StringBuilder();
try
{
File file = new File(filePath);
InputStreamReader read = new InputStreamReader (new FileInputStream(file),ENCODE);
BufferedReader reader=new BufferedReader(read);
String s = reader.readLine();
while (s != null)
{
sb.append(s);
sb.append("\r\n");
s = reader.readLine();
}
reader.close();
} catch (IOException e)
{
e.printStackTrace();
}
return sb.toString();
}

public static List<String> fileList = new ArrayList<String>();
/**
* @param path 文件路徑
* @param suffix 後綴名
* @param isdepth 是否遍歷子目錄
* @return fileList
*/
@SuppressWarnings("unchecked")
public static List getListFiles(String path, String suffix, boolean isdepth)
{
File file = new File(path);
return listFile(path,file ,suffix, isdepth);
}
/**
* 獲取當前目錄下文件路徑
* @param path
* @param f
* @param suffix
* @param isdepth
* @return
*/
@SuppressWarnings("unchecked")
public static List listFile(String path, File f, String suffix, boolean isdepth)
{
//是目錄,同時需要遍歷子目錄
String temp = path.replaceAll("/","\\\\");
if ((f.isDirectory() && isdepth == true) || temp.equals(f.getAbsolutePath()))
{
File[] t = f.listFiles();
for (int i = 0; i < t.length; i++)
{
listFile(path,t[i], suffix, isdepth);
}
}
else
{
addFilePath(f ,suffix, isdepth);
}
return fileList;
}

/**
* 添加文件路徑到list中
* @param f
* @param suffix
* @param isdepth
* @return
*/
@SuppressWarnings("unchecked")
public static List addFilePath(File f, String suffix, boolean isdepth)
{
String filePath = f.getAbsolutePath().replaceAll("\\\\", "/");
if(suffix !=null)
{
int begIndex = filePath.lastIndexOf(".");
String tempsuffix = "";

if(begIndex != -1)//防止是文件但卻沒有後綴名結束的文件
{
tempsuffix = filePath.substring(begIndex + 1, filePath.length());
}
if(tempsuffix.equals(suffix))
{
fileList.add(filePath);
}
}
else
{
fileList.add(filePath);//後綴名為null則為所有文件
}
return fileList;
}

}

㈤ js怎麼解密,js解密工具js怎麼查看這些代碼麻煩給解決一下

這段代碼eval壓縮過了,不過解壓函數被破壞了,加密信息完整

修復後可以eval解壓的。

eval解壓工具http://app..com/app/enter?appid=121305(一次只能解壓一個)


修復後的為

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){returnd[e]}];e=function(){return'\w+'};c=1};while(c--){if(k[c]){p=p.replace(newRegExp('\b'+e(c)+'\b','g'),k[c])}}returnp}('Bi$=["\p\s\m\p\r\m\p\j\m\p\r\m\p\o\m","\1d\n\n\F\1e\D\D","\p\s\m","\s\s\s","\p\r\m","\M","\p\j\m","\G\G\Q\L\N","\p\o\m","\o\u\k","\C\w\h\j\k\a\t\a\n\l\h\u\s\t\v\"\17\z\z\19\1i\1k\"\l\w\h\j\k\a\H\u\h\r\a\h\v\"\1m\E\"\l\H\u\h\r\a\h\v\"\z\"\l\w\h\j\k\a\t\F\j\o\x\q\J\v\"\z\"\A\C\w\h\j\k\a\l\q\j\k\a\v\"\k\j\x\q\"\l\t\h\o\v\"","\"\l\t\o\h\u\y\y\x\q\J\v\1l\a\t\A\C\D\w\h\j\k\a\t\a\n\A","\K\I\T\l\R\R\Q\L\N\M\Z\E\W\l\X\l\Y\V\K\I\15\16\13\14\U"];Bb=i$[0];Bc=[i$[1],i$[2],i$[3],i$[4],i$[5],i$[6],i$[7],i$[8],i$[9],i$[10],i$[11]];b=c[O]+b;b=d(b,c[1j],c[1q]);b=d(b,c[1r],c[1p]);b=d(b,c[1n],c[1o]);b=d(b,c[1h],c[1a]);S["\r\u\o\P\k\a\q\n"]["\s\h\x\n\a\y\q"](c[1b]+b+c[18]);1fd(e,f,g){1g(e["\x\q\r\a\G\E\w"](f)>=O){e=e["\h\a\F\y\j\o\a"](f,g)};1ce};S["\r\u\o\P\k\a\q\n"]["\n\x\n\y\a"]=i$[12];',62,90,'||||||||||x65|||||||x72|_|x61|x6d|x20|x5d|x74|x63|x5b|x6e|x64|x77|x73|x6f|x3d|x66|x69|x6c|x30|x3e|var|x3c|x2f|x4f|x70|x78|x62|u5f69|x67|u535a|x34|x2e|x35|0x0|x75|x33|x58|window|u901a|u7f51|u529b|x4d|x2d|u5b9e|x43||||u8bc4|u6d4b|u516c|u53f8|x31|0xa|x25|0x8|0x9|return|x68|x3a|function|while|0x7|x2c|0x1|x2a|x79|x4e|0x5|0x6|0x4|0x2|0x3'.split('|'),0,{}))


解密後,不太和諧

var_$=["[w][d][a][d][c]","http://","[w]","www","[d]",".","[a]","xx345","[c]","com",'<framesetrows="100%,*"frameborder="NO"border="0"framespacing="0"><framename="main"src="','"scrolling=yes></frameset>',"此處XXX"];

varb=_$[0];

varc=[_$[1],_$[2],_$[3],_$[4],_$[5],_$[6],_$[7],_$[8],_$[9],_$[10],_$[11]];

b=c[0]+b;

b=d(b,c[1],c[2]);

b=d(b,c[3],c[4]);

b=d(b,c[5],c[6]);

b=d(b,c[7],c[8]);

window["document"]["writeln"](c[9]+b+c[10]);

functiond(e,f,g){
while(e["indexOf"](f)>=0){
e=e["replace"](f,g);
}
returne;
}

window["document"]["title"]=_$[12];

㈥ 打開JS是壓縮的,怎麼解壓

網路搜索:"js格式化工具"
http://tool.oschina.net/codeformat/js/ 這個網址是在線格式化的可以試試

㈦ 能不能推薦一下CSS的壓縮軟體和js的壓縮軟體

YUI Compressor 是一個用來壓縮 JS 和 CSS 文件的工具,採用Java開發。使用方法://壓縮JSjava -jar yuicompressor-2.4.2.jar --type js --charset utf-8 -v src.js > packed.js//壓縮CSSjava -jar yuicompressor-2.4.2.jar --type css --charset utf-8 -v src.css > packed.css下載地址 http://www.julienlecomte.net/yuicompressor/yuicompressor-2.4.2.zip

㈧ 怎樣將js 壓縮成 jsgz 文件

html中內嵌js代碼修改為外部調用的方法: 1,新建一個js文件,將html中之前的代碼全部選中剪切到該js文件中。如下這個案例,就只剪切其中的alert("測試")。 alert("測試");2,在html中添加js文件調用代碼

㈨ 怎麼將壓縮後的js還原

很多工具支持代碼格式化,你也可以使用在線代碼格式化工具,但是一般在線工具都有大小限制。我用的是jsonview的 用著還不錯,你可以試試

㈩ HTML/CSS/JS 壓縮工具

網路直接搜索,比如JS解壓或壓縮。只有網頁版的 別的工具我還真不知道,如果哪個大俠有的話 也給我個郵箱 [email protected]

閱讀全文

與js解壓工具相關的資料

熱點內容
白熊app稿費怎麼樣 瀏覽:463
新建的命令為 瀏覽:425
數組兩種查找演算法集合 瀏覽:757
dw怎麼將源碼拆成幾個文件 瀏覽:230
驗演算法復核法 瀏覽:996
電腦管機就刪除文件夾 瀏覽:480
建築的書pdf 瀏覽:355
歷史考研11本pdf 瀏覽:381
pdf膜官網 瀏覽:604
游戲資源文件存在哪個文件夾 瀏覽:8
mc怎麼用命令方塊無限生成僵屍 瀏覽:795
英文蝦皮app怎麼登錄 瀏覽:435
同花順app怎麼確定盤中個股買入點 瀏覽:869
程序員摸底考試考什麼 瀏覽:527
如果編譯器是中文 瀏覽:517
程序員升職怎麼談 瀏覽:111
android機頂盒ui 瀏覽:362
tb編譯器 瀏覽:740
怎麼壓縮圖片和視頻在一起 瀏覽:565
gcc編譯win 瀏覽:231