nodejs
他强任他强03
科技改变未来
展开
-
node连接kafka2.0
nodejs连接kafka2.0原创 2022-09-30 10:10:18 · 667 阅读 · 0 评论 -
nodejs连接ftp上传下载
依赖//ftp 模块是目前找到的还不错的,对于ftp的基本功能都支持npm install ftp连接ftpconst ftp = require('ftp');//连接FTPconst client = new ftp();client.on('ready',()=>{ console.log('ftp client is ready');});client.connect({ host : '***.***.***.***', port : '****',原创 2022-03-02 14:22:55 · 4363 阅读 · 4 评论 -
node发送post请求_使用Node发出HTTP POST请求
node发送post请求There are many ways to perform an HTTP POST request in Node, depending on the abstraction level you want to use.有多种方法可以在Node中执行HTTP POST请求,具体取决于您要使用的抽象级别。The simplest way to perform an HTTP request using Node is to use the Axios library:使用N转载 2022-01-27 13:50:41 · 6785 阅读 · 0 评论 -
ts里变量定义any报错Unexpected any. Specify a different type.
关闭any类型的警告:在 .eslintrc.js文件中找到rules 添加一行代码即可"@typescript-eslint/no-explicit-any": ["off"]原创 2021-08-24 10:26:20 · 2399 阅读 · 0 评论 -
node异步方法的异步调用与同步调用
异步方法:module.exports = class QueryLarbor { querydata() { return new Promise((resolve,reject) => { client .search({ index: configs.labor_index, type: type, body: JSON.stringify(esbody), }) .then((re原创 2021-08-20 14:05:22 · 473 阅读 · 0 评论 -
nodejs新增资料到elasticsearch报错“[invalid_type_name_exception] Document mapping type name can‘t start with
如下报错解决:elasticsearch安装16.0.0版本即可cnpm i elasticsearch@16.0.0const es = require('elasticsearch');const client = new es.Client({ host: 'xxxx:9200' });client.ping() .then(res => console.log('connection success', res)) .catch(err => console原创 2021-08-20 08:39:05 · 1373 阅读 · 0 评论 -
nodejs获取elasticsearch数据
const es = require('elasticsearch');const client = es.Client({ host: '10.66.24.101:9200' }); client.ping() .then(res => console.log('connection success', res)) .catch(err => console.error('wrong connection', err)); client.search({ ind转载 2021-08-16 14:16:21 · 394 阅读 · 0 评论 -
nodejs模块nodemailer基本使用-邮件发送(支持附件)
nodejs模块nodemailer基本使用-邮件发送(支持附件)下载模块cnpm install nodemailer后端代码–不带附件var nodemailer = require('nodemailer');var transporter = nodemailer.createTransport({ service: 'qq', auth: { user: '527828938@qq.com', pass: 'ugxovfwhvxxxxxx' //授权码,通过QQ转载 2021-04-13 11:08:55 · 369 阅读 · 0 评论 -
nodejs读取数据库数据转换为excel表格
使用nodejs将mysql数据库中的数据导出成excel格式var mysql = require('mysql');var xlsx = require('node-xlsx');var fs = require('fs');var conn = mysql.createConnection({ host: '127.0.0.1', user: 'root', password: '123', database:'wksits', port: 3306});var data = [转载 2021-04-12 13:17:55 · 1076 阅读 · 1 评论 -
使用nodejs发送订阅mqtt
使用nodejs发送订阅mqttcnpm i mqtt --savevar mqtt = require('mqtt');var opt={ port:1883}var client=mqtt.connect('tcp://10.66.28.51',opt);client.on('connect',function(){ console.log("mqtt已连接"); // client.publish('wks/cim/ASPY/#','需要发送的信息');原创 2021-04-12 09:20:51 · 728 阅读 · 0 评论 -
使用nodejs生产消费kafka
使用nodejs生产消费kafkacnpm i node-kafkaproducer.jsconst kafka = require('kafka-node');let conn = {'kafkaHost':'10.66.28.25:9092'};var MQ = function (){ this.mq_producers = {};}MQ.prototype.AddProducer = function (conn, handler){ console.log('增转载 2021-04-12 09:00:44 · 915 阅读 · 0 评论