Node系列——Node第三方模块使用总结

Node中主流模块汇总

1. 其他人总结的

2. 数据库相关

Drivers
    PostgreSQL - PostgreSQL client. Pure JavaScript and native libpq bindings.
    Redis - Redis client.
    LevelUP - LevelDB.
    MySQL - MySQL client.
    nano - CouchDB client.
    Aerospike - Aerospike client.
    Couchbase - Couchbase client.
    MongoDB - MongoDB driver.
ODM / ORM
    Sequelize - Multi-dialect ORM. Supports PostgreSQL, SQLite, MySQL.
    Bookshelf - ORM for PostgreSQL, MySQL and SQLite3 in the style of Backbone.js.
    Massive - PostgreSQL data access tool.
    Mongoose - Elegant MongoDB object modeling.
    Waterline - Datastore-agnostic tool that dramatically simplifies interaction with one or more databases.
    Iridium - MongoDB ORM with support for promises, distributed caching, preprocessing, validation and plugins.
    OpenRecord - ORM for PostgreSQL, MySQL, SQLite3 and RESTful datastores. Similar to ActiveRecord.
    orm2 - ORM for PostgreSQL, MariaDB, MySQL, Amazon Redshift, SQLite, MongoDB.
    firenze - Adapter-based ORM for MySQL, Memory, Redis, localStorage and more.
    pg-promise - PostgreSQL framework for native SQL using promises.
    Objection.js - Lightweight ORM built on the SQL query builder Knex.
Query builder
    Knex - Query builder for PostgreSQL, MySQL and SQLite3, designed to be flexible, portable, and fun to use.
Other
    NeDB - Embedded persistent database written in JavaScript.
    Lowdb - Small JavaScript database powered by Lodash.

3. 爬虫

4. 全文检索

5. 日志

6. 发邮件

Nodemailer - The fastest way to handle email. emailjs - Send text/HTML emails with attachments to any SMTP server.

7. 发短信

yunpian-sdk

8. 操作excel

npoi

9. 测试

9.1. 单元测试

9.2. e2e测试

9.3. 压力测试

9.4. 数据模拟

AVA - Futuristic test runner. Mocha - Feature-rich test framework making asynchronous testing simple and fun. nyc - Code coverage tool built on istanbul that works with subprocesses. tap - TAP test framework. tape - TAP-producing test harness. power-assert - Provides descriptive assertion messages through the standard assert interface. Mochify - TDD with Browserify, Mocha, PhantomJS and WebDriver. trevor - Run tests against multiple versions of Node.js without switching versions manually or pushing to Travis CI. loadtest - Run load tests for your web application, with an API for automation. Sinon.JS - Test spies, stubs and mocks. navit - PhantomJS / SlimerJS wrapper to simplify browser test scripting. nock - HTTP mocking and expectations. intern - Code testing stack. toxy - Hackable HTTP proxy to simulate failure scenarios and network conditions. hook-std - Hook and modify stdout/stderr. testen - Run tests for multiple versions of Node.js locally with NVM. Nightwatch - Automated UI testing framework based on Selenium WebDriver. WebdriverIO - Automated testing based on the WebDriver protocol. Jest - Painless JavaScript testing. TestCafe - Automated browser testing.

10. 事件队列

  • bee-queue
    • 封装了redis的事件队列 kue - Priority job queue backed by Redis. bull - Persistent job and message queue. agenda - Lightweight job scheduling on MongoDB. idoit - Redis-backed job queue engine with advanced job control.

11. 定时任务

node-schedule

12. 微信相关

  • wechaty

13. 表单

body-parse formable

14. 部署

PM2 - Advanced Process Manager. nodemon - Monitor for changes in your app and automatically restart the server. node-mac - Run scripts as a native Mac daemon and log to the console app. node-linux - Run scripts as native system service and log to syslog. node-windows - Run scripts as a native Windows service and log to the Event viewer. forever - Ensures that a given script runs continuously. supervisor - Restart scripts when they crash or restart when a *.js file changes. Phusion Passenger - Friendly process manager that integrates directly into Nginx. naught - Process manager with zero downtime deployment.

15. 人工智能

  • superscript

16. 工具类

glob uuid xml2json async(流程控制) axios fs-extra

17. 高级玩意

amqp bearcat(IoC,AOP)

18. 其他

  • gm
    • 图片处理
    • http://github.com/aheckmann/gm
    • 简介
      • ImageMagick和GraphicsMagick主要用于图片的创建、编辑、合成图片。它们可以读取、转换、写入多种格式的图片。图片切割、颜色替换、各种效果的应用,图片的旋转、组合,文本,直线,多边形,椭圆,曲线,附加到图片伸展旋转。
      • gm模块实现了ImageMagick和GraphicsMagick的相关功能,让我们很方便的在Node中进行图片的相关操作
  • sharp
    • 主要用于图片的处理,相比ImageMagick 和 GraphicsMagick ,处理速度会快四五倍。主要支持JPEG,PNG,WebP,TIFF,GIF 和 SVG images
    • http://github.com/lovell/sharp

18.1. spritesmith

  • 类别:图片处理
  • 官网:http://github.com/ensighten/spritesmith
  • 简介:
    • SSSprites在国内很多人叫css精灵,是一种网页图片应用处理方式。它允许你将一个页面涉及到的所有零星图片都包含到一张大图中去,这样一来,当访问该页面时,载入的图片就不会像以前那样一幅一幅地慢慢显示出来了。
    • spritesmith 模块就是将多个图片生成 CSSSprites 和 拼成一张图
  • 代码:
var fs = require('fs');

var Spritesmith = require('spritesmith');

Spritesmith.run({
 src: [    __dirname + '/fork.png',    __dirname + '/github.png',    __dirname + '/twitter.png'
 ],
 engine: require('canvassmith')
}, function handleResult (err, result) {  
 if (err) {    throw err;
 }  
 fs.writeFileSync(__dirname + '/canvassmith.png', result.image);  result.coordinates, result.properties; });

18.2. TinyColor

  • 类别:颜色处理
  • 官网:https://github.com/bgrins/TinyColor
  • 简介:
    • 在日常开发中,我们经常会处理一些颜色值的转换,正好TinyColor就派上用场了,能很方便的进行颜色值的转换
  • 代码:
var color = tinycolor("red");

color.getFormat(); // "name"

color = tinycolor({r:255, g:255, b:255});

color.getFormat(); // "rgb"

18.3. pdfkit

  • 类别:文档处理
  • 官网:http://github.com/devongovett/pdfkit
  • 简介:
    • 起初,生成PDF文件似乎是件很繁琐的任务,但有了PDFKit,这个任务就容易多了。但对于Node.js的PDFKit模块,知道的人并不多,这倒是很意外。有了PDFKit模块,处理PDF文件变得非常容易,它让你避免了所有的复杂工作,并提供用CoffeeScript(也可以作为普通版的Javascript使用)写成的简易的API
  • 代码:
var PDF = require('pdfkit');      

var fs = require('fs'); 

var text = 'ANY_TEXT_YOU_WANT_TO_WRITE_IN_PDF_DOC'; 

doc = new PDF();             
doc.pipe(fs.createWriteStream('PATH_TO_PDF_FILE')); 

doc.text(text, 100, 100);        

doc.end();

18.4. marked

  • 类别:文件处理
  • 官网:http://github.com/chjj/marked
  • 简介:
    • Markdown 是一种轻量级的「标记语言」,它的优点很多,目前也被越来越多的写作爱好者,撰稿者广泛使用。因此显示Markdown格式的需求则随之而来,marked就能很好处理这个需求
  • 代码:
var marked = require('marked');

console.log(marked('I am using __markdown__.'));

// Outputs: <p>I am using <strong>markdown</strong>.</p>

猜你喜欢

转载自my.oschina.net/u/1416844/blog/915816