Socket
Book a DemoInstallSign in
Socket

gearjs

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gearjs

utils for nodejs

latest
Source
npmnpm
Version
0.0.12
Version published
Maintainers
1
Created
Source

gearjs

Some useful tools for nodejs development

Some tools are from https://github.com/wyicwx/mutils

##Usage

var gear = require('gear');

var _ = gear._;//underscore

//watch object`s change
var listenid = gear.listen.add({}, function(data){//add watch
  //do something
});
gear.listen.set(listenid, {a:1});//set object, and will trigger callback function of 'add'

gear.jsonsize(jsonobj);//calculate the length of a simple json object

gear.fs.mkdir('a/b/c', './');//make dir ./a/b/c

gear.fs.readFile('test.js').done(function(data){//read local file
  //content of test.js
});
gear.fs.readFile('http://test.com/test.js').done(function(data){//read net file
  //content of test.js
});

gear.fs.copyFile(file, tarDir, [
  { match : '@', replacement : '-', isreg:false}
]).done(function(src){
  
});

gear.fs.clearDirSync('a', function(){//remove all files from 'a' directory
  //do something
});

//Sequential execution in nodejs
var c = gear.connect();
c.use(function(data, next, done) {
  //coding1
  next(data); //pass to next function 
});
c.use(function(data, next, done) {
  //coding2
  done(data); //stop pass and trigger to fire
});
c.fire();

Keywords

utils

FAQs

Package last updated on 14 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.