
node.js
weixin_43903378
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
node.js windows下安装与配置
转自https://www.cnblogs.com/liuqiyun/p/8133904.html转载 2019-06-07 08:20:55 · 91 阅读 · 0 评论 -
node.js https 模块设置请求头等信息
// https://www.iqiyi.com/v_19rs789v28.htmlvar fs = require('fs');var https = require('https');var option={ rejectUnauthorized: false, hostname:'www.iqiyi.com', path:'/', headers:{...原创 2019-06-18 16:54:27 · 5726 阅读 · 0 评论 -
node.js将buffer对象转换为json对象
d 是buffer对象 let jsstr = JSON.stringify(d); let jsondata = JSON.parse(jsstr); let buf = new Buffer(jsondata); let data = buf.toString(); sx = JSON.par...原创 2019-06-11 08:58:01 · 5713 阅读 · 0 评论 -
node.js async await 配合Promise对象使用
function getData(){ return new Promise(function(resolve, reject){ setTimeout(function(){ var uname = 'zhang'; console.log('this is timeout'); resolve(un...原创 2019-06-15 15:34:12 · 268 阅读 · 0 评论 -
node.js 获取异步方法里面数据 的方式
第一种 使用回调函数:function getData(callback){ setTimeout(function(){ var name = 'xxxx'; callback(name); }, 1000);}// 外部获取异步方法里面的数据 采用回调函数的方式getData(function(data){ c...原创 2019-06-10 07:40:18 · 869 阅读 · 1 评论 -
node.js Promise简单介绍
转自百度:https://baijiahao.baidu.com/s?id=1589455136001194151&wfr=spider&for=pc转载 2019-06-10 07:20:54 · 433 阅读 · 0 评论 -
node.js child_process 执行中文命令 出现乱码解决方法
var child_process = require('child_process');var iconv = require('iconv-lite');var encoding = 'cp936';var binaryEncoding = 'binary';child_process.exec('ipconfig', { encoding: binaryEncoding }, fu...转载 2019-06-19 16:32:20 · 6641 阅读 · 1 评论 -
node.js 匿名函数自执行 会把异步变为同步模式?
有些疑问记录一下原创 2019-06-19 12:48:26 · 487 阅读 · 0 评论 -
node.js 获取异步方法里面的数据 =》 两种方式
第一种:通过回调函数实现:var fs = require('fs);function getmime(callback){ fs.readFile('./t1.js', function(err, data){ // 现在理解,异步方法里还有别的引用 就不会提前释放 callback(data); });}getmime(func...原创 2019-06-09 12:12:23 · 380 阅读 · 0 评论 -
node.js 将文件目录读取 通过匿名函数自执行 将异步改为同步
var fs = require('fs');var filesarray = [];fs.readdir('html', function(error, files){ if(error){ console.log(error.stack); console.log('--------'); console.log('文件夹读取失败'...原创 2019-06-08 10:41:29 · 360 阅读 · 0 评论 -
node.js 笔记1 模块方面
url 模块parse 解析url 可以用来获取查询参数xx.jsexports.xx = xx另一个文件引用 require(’./xx.js);获取的句柄 相当于 xx.js 中的 exportsxx.jsmodule.exports = xx这样被人引用 相当于就是直接拿到了 xx当require xx 的时候, 如果xx不在当前文件夹 , node就会到 node_mo...原创 2019-06-07 15:24:43 · 157 阅读 · 0 评论 -
node.js 代码修改 自动识别重启工具
npm install supervisor -gsupervisor xx.js 代替 node xx.js能实现自动重启服务,识别代码更新原创 2019-06-07 12:49:26 · 144 阅读 · 0 评论 -
js 出现 replace 无法完全替换 指定字符串的时候的解决办法
/{/g 通过这种方式替换掉replace( /这里填写需要被替换的字符串/g , "");原创 2019-07-16 15:15:05 · 2297 阅读 · 1 评论