Comparing version 1.0.1 to 1.0.3
@@ -1,3 +0,3 @@ | ||
var indexOfc : function(buf, chr) { | ||
for (var i = 0; i < buf.length ; i++) | ||
var indexOfc = function(buf, chr, offset) { | ||
for (var i = offset||0; i < buf.length ; i++) | ||
if(buf[i] ==chr) return i; | ||
@@ -8,2 +8,3 @@ return -1; | ||
module.exports = function(buf, search, offset) { | ||
@@ -13,3 +14,3 @@ if(typeof search == "string") | ||
else if(typeof search == "number") | ||
search = new Buffer([search]); | ||
return indexOfc(buf, search, offset); | ||
@@ -31,4 +32,5 @@ offset = offset||0 | ||
if (s > -1 && buf.length - s < search.length) return -1; | ||
if (s > -1 && buf.length - s < search.length) | ||
return -1; | ||
return s; | ||
} |
@@ -0,0 +0,0 @@ var crypto = require('crypto'); |
@@ -0,0 +0,0 @@ var ASN_LONG_LEN = 0x80, SSH_RSA = 'ssh-rsa'; |
@@ -5,2 +5,5 @@ | ||
module.exports = function(str, armor){ | ||
if(Buffer.isBuffer(str)) | ||
str = str.toString('base64'); | ||
str = [].concat(["-----BEGIN "+armor+"-----"], str_chunk(str, 64), ["-----END "+armor+"-----"]); | ||
@@ -7,0 +10,0 @@ str = str.join("\n"); |
var fs = require('fs'); | ||
var isDirectorySync = require('./isDirectorySync'); | ||
module.exports = function(file_path) { | ||
var self = module.exports = function(file_path) { | ||
var files = []; | ||
@@ -9,4 +10,4 @@ if( fs.existsSync(file_path) ) { | ||
var curfile_path = file_path + "/" + file; | ||
if(fs.lstatSync(curfile_path).isDirectory()) { // recurse | ||
fs.deleteFolderRecursive(curfile_path); | ||
if(isDirectorySync(curfile_path)) { // recurse | ||
self(curfile_path); | ||
} else { // delete file | ||
@@ -13,0 +14,0 @@ fs.unlinkSync(curfile_path); |
@@ -0,0 +0,0 @@ var fs = require('fs'); |
@@ -0,0 +0,0 @@ var fs = require('fs'); |
var fs = require('fs'); | ||
module.exports = function(file_path){ | ||
return fs.statSync(file_path).isDirectory(); | ||
return fs.existsSync(file_path) && fs.statSync(file_path).isDirectory(); | ||
} |
var fs = require('fs'); | ||
module.exports = function(file_path){ | ||
return fs.statSync(file_path).isFile(); | ||
return fs.existsSync(file_path) && fs.statSync(file_path).isFile(); | ||
} |
@@ -0,0 +0,0 @@ var fs = require('fs'), |
@@ -0,0 +0,0 @@ var fs = require('fs'); |
var fs = require('fs'); | ||
var path = require('path'); | ||
var os = require('os'); | ||
var crypto = require('crypto'); | ||
var randString = require('mout/random/randString'); | ||
var exitListenerAttached = false; | ||
var filesToDelete = []; | ||
var tmppath = module.exports = function(ext){ | ||
ext = ext || "tmp"; | ||
var fname = ext + "-" + randString(8) + "." + ext; | ||
function deleteOnExit(file_path) { | ||
if (!exitListenerAttached) { | ||
console.log("Registering for cleanup"); | ||
process.on('exit', cleanupFilesSync); | ||
//makes sure exit is called event on sigint \o/ | ||
process.on('SIGINT', process.exit); | ||
exitListenerAttached = true; | ||
} | ||
filesToDelete.push(file_path); | ||
} | ||
function cleanupFilesSync() { | ||
while ((toDelete = filesToDelete.shift()) !== undefined) { | ||
if(fs.existsSync(toDelete)) | ||
fs.unlinkSync(toDelete); | ||
} | ||
} | ||
var tmppath = module.exports = function(ext, len, trash){ | ||
len = len || 8; ext = ext || "tmp"; | ||
if(trash === undefined) trash = true; | ||
var body = crypto.randomBytes(len).toString('base64').replace(/\//g, '+').substr(0, len); | ||
var fname = ext + "-" + body + "." + ext; | ||
var file_path = path.join(os.tmpdir(), fname); | ||
return fs.existsSync(file_path) ? tmppath(ext) : file_path; | ||
var fullpath = fs.existsSync(file_path) ? tmppath(ext) : file_path; | ||
if(trash) | ||
deleteOnExit(fullpath); | ||
return fullpath; | ||
} | ||
@@ -0,0 +0,0 @@ module.exports = function(fn) { |
@@ -0,0 +0,0 @@ module.exports = Math.log10 || function(x) { |
{ | ||
"name": "nyks", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"description": "nodejs exupery style", | ||
@@ -15,3 +15,4 @@ "keywords": [ | ||
"expect.js": "^0.3.1", | ||
"mocha": "^2.2.5" | ||
"mocha": "^2.2.5", | ||
"istanbul": "~0.3.18" | ||
}, | ||
@@ -30,3 +31,3 @@ "homepage": "http://github.com/131/nyks", | ||
"scripts": { | ||
"test": "node node_modules/mocha/bin/mocha -C test/*" | ||
"test": " node node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha test/" | ||
}, | ||
@@ -33,0 +34,0 @@ "readme": "# nyks toolkit\r\n\r\nExtend nodejs & javascript native API of missing functions.\r\n", |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ var fs = require('fs'); |
@@ -0,0 +0,0 @@ var util = require('util'); |
module.exports = function(str, chunkSize){ | ||
if(chunkSize <= 0) | ||
return [str]; | ||
var chunks = []; chunkSize = chunkSize || 1; | ||
@@ -3,0 +6,0 @@ while (str) { |
@@ -0,0 +0,0 @@ var forIn = require('mout/object/forIn'); |
@@ -0,0 +0,0 @@ // http://stackoverflow.com/q/617647 |
@@ -0,0 +0,0 @@ //recursive version of replaces |
@@ -0,0 +0,0 @@ var endsWith = require('mout/string/endsWith'); |
@@ -0,0 +0,0 @@ var startsWith = require('mout/string/startsWith'); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
19611
34
460
1
3
12