随笔分类 - nodejs
摘要:https://micro-zoe.github.io/micro-app/ 官网:https://jd-opensource.github.io/micro-app/
阅读全文
摘要:
阅读全文
摘要:### demo1 ``` const buf1 = Buffer.from([0x24, 0x40, 0x24, 0x40]);// 这样加上`0x`,就是定义的16进制 console.log(buf1);// console.log(buf1[0]);//36 console.log(buf1
阅读全文
摘要:process.stdout.write('hello '); 这行代码的作用是在控制台中输出字符串 "hello ",并且不会自动换行。这是因为 process.stdout 属性代表 Node.js 进程的标准输出流,可以用于将数据写入到控制台中。 `process.stdout.write()
阅读全文
摘要:https://www.cnblogs.com/pecool/p/11730101.html
阅读全文
摘要:dot-prop是一个 JavaScript 库,用于处理嵌套对象的属性,它允许您通过点符号(.)访问和修改嵌套对象的属性, 而不需要使用复杂的递归函数或多个if语句来处理。 引入dot-prop库非常简单,可以通过 npm 进行安装: npm install dot-prop 使用dot-prop
阅读全文
摘要:在 Node.js 中,每个模块都是一个单独的文件,并且每个模块都有自己的作用域。 为了使模块中定义的函数、变量、对象或类能够在其他模块中使用, Node.js 提供了两个对象:exports 和 module.exports。虽然它们在某些情况下可以互换使用, 但它们实际上有不同的用途和行为。 e
阅读全文
摘要:从异步,用延时来处理,改成同步获取数据 获取数据主要分2步: 1.从redis集合中获取数组; 2.遍历数组,抓取其中字符串,解析,拼接成需要的数据,返回给前端 原代码,用sleep方法,避免异步数据处理带来的提前返回数据的问题; (缺点:时间比较久,逻辑中是有问题的) // 获取线路上公交的位置信
阅读全文
摘要:可以使用redis模块来连接和操作Redis数据库。以下是使用该模块获取Redis集合内容的同步方法: // 引入redis模块 const redis = require('redis'); // 创建redis客户端 const client = redis.createClient(); //
阅读全文
摘要:delete https://blog.csdn.net/m0_58293192/article/details/128819036
阅读全文
摘要:用async命名的函数,哪个函数调用的也需用async来命名!!
阅读全文
摘要:const redis = require('redis'); const client = redis.createClient(); // 向集合中添加元素 client.sadd('myset', 'foo', 'bar', 'baz', (err, result) => { console.
阅读全文
摘要:https://www.cnblogs.com/xinbing/p/16874367.html 在进制转换中怎么用的?
阅读全文
摘要:// console.log(Buffer.from([1,2,3]));//<Buffer 01 02 03>等价于<Buffer Ox01 0x02 ox03>,内容是十六进制的 // console.log(Buffer.from('test'))//<Buffer 74 65 73 74>
阅读全文
摘要:通过this不行 通过 module.exports 来实现 const xml2js = require('xml2js') module.exports = { // 十六进制转10进制; hexadecinal_2_decimal:(hexString) => { //const hexStr
阅读全文
摘要:const kaitou = "@"; Buffer.from(kaitou, "utf8").toString("hex"); 给以以上nodejs的逆算法 const hexString = "24402440"; // 十六进制字符串 const buffer = Buffer.from
阅读全文
摘要:安装成功后,需要配置到全局,才可以直接使用pm2命令!! echo $PATH 找到全局环境路径 npm安装的pm2,路径是在nodejs/bin的路径下 截图开始是配置nodejs到全局环境命令的 软链接命令 参考:https://www.likecs.com/show-203632439.htm
阅读全文
摘要:https://www.cnblogs.com/veezeng/p/11164066.html https://nodejs.org/dist/
阅读全文
摘要:在这个例子中,我们创建了一个新的https.Agent实例, 并将其作为httpsAgent选项传递给axios.get()方法。 我们通过设置rejectUnauthorized选项为false来禁用SSL证书验证。 如果您需要在生产环境中使用自签名的SSL证书, 最好的方法是将SSL证书添加到N
阅读全文
摘要:<ns:selectLineInfoResponse xmlns:ns="http://service"><ns:return>用户名或密码不正确!</ns:return></ns:selectLineInfoResponse> nodejs如何处理成json格式
阅读全文