Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// node-uuid - string form
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4();
rate('nodeuuid.v4()', t);
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary');
rate('nodeuuid.v4(\'binary\')', t);
var buffer = new nodeuuid.BufferClass(16);
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary', buffer);
rate('nodeuuid.v4(\'binary\', buffer)', t);
// libuuid - string form
for (var i = 0, t = Date.now(); i < N; i++) uuid();
rate('uuid()', t);
for (var i = 0, t = Date.now(); i < N; i++) uuid('binary');
rate('uuid(\'binary\')', t);
// uuid-js - string form
for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(4);
rate('uuidjs.create(4)', t);
// 140byte.es
for (var i = 0, t = Date.now(); i < N; i++) 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(s,r){r=Math.random()*16|0;return (s=='x'?r:r&0x3|0x8).toString(16)});
rate('140byte.es_v4', t);
console.log('');
console.log('# v1');
// node-uuid - v1 string form
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1();
rate('nodeuuid.v1()', t);
function Session(host) {
var id = UUID.generate();
var terminal = Terminal();
var replay = "";
var width;
var height;
var obsolesence = Q.defer();
var readQueue = Queue();
// construct the child
var tty;
tty = TTY.open("telnet", [host]);
var fd = tty[0];
var child = tty[1];
var stream = new Stream(fd);
stream.readable = stream.writable = true;
stream.resume();
stream.on("data", function (data) {
} catch(e) {
res.send("bad code on s function " + e.message);
return;
}
var m = fields['map'];
var r = fields['reduce'];
var file_data = null;
if(files['file']) {
console.log("Reading input file " + files['file'].path);
file_data = fs.readFileSync(files['file'].path);
}
var u = uuid.generate();
state[u] = {};
console.log("Slicing.....");
var m_results = [];
var m_jobs = s.runInNewContext({})(file_data);
for(var i=0; i
everyone.now.createRoom = function(cb) {
var room_id;
while (!room_id) {
room_id = Buffer(uuid.generate('binary')).toString('base64').slice(0, 4);
if (chatrooms.hasOwnProperty(room_id))
room_id = undefined;
}
var group = nowjs.getGroup(room_id);
chatrooms[room_id] = {
group: group,
backlog: [],
members: {}
};
console.log('New room created: ' + room_id);
cb(room_id);
}
var saveBanner = function (dashboardId, username, filename, mime, stream) {
var uuid = require('uuid');
var registry = getRegistry();
var path = registryBannerPath(dashboardId, username);
var resource = {
content: stream,
uuid: uuid.generate(),
mediaType: mime,
name: filename,
properties: {}
};
registry.put(path, resource);
};
Registry.prototype.query = function (options) {
var res,
query = options.query,
uuid = require('uuid'),
name = options.name || uuid.generate(),
cache = options.cache || true,
Collections = java.util.Collections,
path = '/_system/config/repository/components/org.wso2.carbon.registry/queries/' + name;
if (!this.exists(path) || !cache) {
this.put(path, {
content: query,
mediaType: 'application/vnd.sql.query',
properties: {
resultType: options.resultType
}
});
}
res = this.registry.executeQuery(path, Collections.emptyMap());
if (!cache) {
this.remove(path);
}
export function generate() {
const uuid = UUID.generate().replace(/-/g, '');
const int = parseInt(uuid, 16);
const baseID = Base62.encode(int);
return ensureLength(baseID);
}
//value should contain the file path and content type
var file;
//If a path is given then use the path to create a file,otherwise
//use the provided file.
if(value.path){
file=new File(value.path);
}
else{
file=value.file;
}
//log.debug('filename :'+file.getName());
//Generate a uuid for the resource
resource.uuid = uuid.generate();
resource.contentType = value.contentType;
resource.contentLength = file.getLength();
resource.content = file;
resource.fileName =file.getName();
resource.tenantId = value.tenantId||'super';
//Save the resource
resource.save();
return resource.uuid+'/'+file.getName();
};
//value should contain the file path and content type
var file;
//If a path is given then use the path to create a file,otherwise
//use the provided file.
if(value.path){
file=new File(value.path);
}
else{
file=value.file;
}
log.debug('filename :'+file.getName());
//Generate a uuid for the resource
resource.uuid = uuid.generate();
resource.contentType = value.contentType;
resource.contentLength = file.getLength();
resource.content = file;
resource.fileName =file.getName();
resource.tenantId = value.tenantId||'super';
//Save the resource
resource.save();
return resource.uuid+'/'+file.getName();
};