Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jscrambler

Package Overview
Dependencies
Maintainers
1
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jscrambler - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

3

jscrambler-client.js

@@ -42,3 +42,2 @@ 'use strict';

* @returns {String} The request path.
* @this JSCramblerClient
*/

@@ -76,3 +75,2 @@ function buildPath (method, path, params) {

* @returns {String} The digested signature.
* @this JScramblerClient
*/

@@ -123,3 +121,2 @@ function generateHmacSignature (method, path, params) {

properties.
* @this JScramblerClient
*/

@@ -126,0 +123,0 @@ function signedParams (method, path, params) {

54

jscrambler.js

@@ -23,14 +23,18 @@ 'use strict';

var deferred = Q.defer();
var path = '/code/' + projectId;
if (sourceId) {
if (!/^.*\..*$/.test(sourceId))
throw new Error('Source extension missing');
else path += '/' + sourceId;
} else if (!/^.*\.zip$/.test(projectId))
path += '.zip';
client.get(path, null, function (err, res, body) {
if (err) deferred.reject(err);
else if (res.statusCode >= 400) deferred.reject(res);
else deferred.resolve(body);
});
this
.pollProject(client, projectId)
.then(function () {
var path = '/code/' + projectId;
if (sourceId) {
if (!/^.*\..*$/.test(sourceId))
throw new Error('Source extension missing');
else path += '/' + sourceId;
} else if (!/^.*\.zip$/.test(projectId))
path += '.zip';
client.get(path, null, function (err, res, body) {
if (err) deferred.reject(err);
else if (res.statusCode >= 400) deferred.reject(res);
else deferred.resolve(body);
});
});
return deferred.promise;

@@ -53,2 +57,28 @@ },

/**
* Poll project until the build finishes.
*/
pollProject: function (client, projectId) {
var deferred = Q.defer();
var isFinished = function () {
this
.getInfo(client)
.then(function (res) {
for (var i = 0, l = res.length; i < l; ++i) {
// Find projectId inside the response
if (res[i].id === projectId) {
// Did it finish?
if (res[i].finished_at) {
deferred.resolve();
return;
}
}
}
// Try again later...
setTimeout(isFinished, 1000);
});
}.bind(this);
isFinished();
return deferred.promise;
},
/**
* Uploads code through the API.

@@ -55,0 +85,0 @@ * @param {JScramblerClient} client

{
"name": "jscrambler",
"description": "JScrambler API client.",
"version": "0.1.2",
"homepage": "https://github.com/magalhas/node-jscrambler",
"version": "0.2.0",
"homepage": "https://github.com/auditmark/node-jscrambler",
"author": {

@@ -12,6 +12,6 @@ "name": "magalhas",

"type": "git",
"url": "git://github.com:magalhas/node-jscrambler.git"
"url": "git://github.com:auditmark/node-jscrambler.git"
},
"bugs": {
"url": "https://github.com/magalhas/node-jscrambler/issues"
"url": "https://github.com/auditmark/node-jscrambler/issues"
},

@@ -21,3 +21,3 @@ "licenses": [

"type": "MIT",
"url": "https://github.com/magalhas/node-jscrambler/blob/master/LICENSE-MIT"
"url": "https://github.com/auditmark/node-jscrambler/blob/master/LICENSE-MIT"
}

@@ -29,6 +29,7 @@ ],

"dependencies": {
"lodash": "*",
"needle": "*"
"q": "^1.0.1",
"lodash": "^2.4.1",
"needle": "^0.6.6"
},
"main": "jscrambler"
}
}

@@ -1,1 +0,34 @@

# JSCrambler Client for Node.js
# JSCrambler Client for Node.js
## Upload/download example
```js
var fs = require('fs-extra');
var jScrambler = require('jscrambler');
var client = new jScrambler.Client({
accessKey: '',
secretKey: ''
});
jScrambler
.uploadCode(client, {
files: ['index.js'],
// Node.js obfuscation settings
rename_local: '%DEFAULT%',
whitespace: '%DEFAULT%',
literal_hooking: '%DEFAULT%',
dead_code: '%DEFAULT%',
dot_notation_elimination: '%DEFAULT%',
dead_code_elimination: '%DEFAULT%',
constant_folding: '%DEFAULT%',
literal_duplicates: '%DEFAULT%',
function_outlining: '%DEFAULT%',
string_splitting:'%DEFAULT%'
})
.then(function (res) {
return jScrambler.downloadCode(client, res.id);
})
.then(function (res) {
fs.outputFileSync('dist.zip', res);
});
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc