随笔分类 - nodejs
摘要:这样做的目的是避免循环引用,编写多余的类型文件 //global.d.ts import type { A } from "./a"; import type { B } from "./b"; declare global { var a: A; var b: B; } //index.ts im
阅读全文
摘要:https://github.com/nodejs/node-addon-api hello world #include <napi.h> using namespace Napi; String Method(const CallbackInfo& info) { Env env = info.
阅读全文
摘要:1. 创建静态库 "hello.lib" release x64 编译前,选择多线程MT,否则可能出现这个错误(error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MD_DynamicRelease”不匹配值“MT_StaticRelease”) 生成解决方案 2.
阅读全文
摘要:const fs = require("fs"); const { Writable, Readable, Duplex, Transform } = require("stream"); // 双向流 const inoutStream = new Duplex({ // 获取写入的数据 writ
阅读全文
摘要:import * as path from 'path'; import * as url from 'url'; const savePath = path.join('public', 'images', 'a.jpg'); // => \public\images\a.jpg const ur
阅读全文
摘要:test/package.json { "name": "test", "main": "index.js", "exports": { ".": { "require": "./index.js" }, "./a": "./functions/a.js", "./b": "./functions/
阅读全文
摘要:github 项目地址 node版本 λ node -v v12.16.2 main.js const ffi = require("@saleae/ffi"); const child_process = require("child_process"); const W32 = require(
阅读全文
摘要:win32 api 也可以试试我写的 node-windows-x64 库 >node -v v12.16.1 >npm install -g node-gyp >npm i @saleae/ffi >node test.js 1 test.js const ffi = require("@sale
阅读全文
摘要:"psaux" "tasklist" "system tasks" win ubuntu 以下代码,只在win上测试过: js const { exec } = require("child_process"); const isWindows = process.platform == "win3
阅读全文
摘要:"ora" 显示loading.. "progress" 进度条 progress ora
阅读全文
摘要:bcrypt install λ npm i bcrypt λ npm i --save-dev @types/bcrypt example import * as bcrypt from 'bcrypt'; const db = {} (async () => { const myPlaintex
阅读全文
摘要:"故障排除" 安装puppeteer,使用cnpm 解决依赖 执行代码
阅读全文
摘要:"文档" mouse.click 是 mouse.move,mouse.down 和 mouse.up 的快捷方式 main.js index.html
阅读全文
摘要:"文档" main.js index.html
阅读全文
摘要:$ npm i -g node-gyp $ mkdir node-addons $ cd node-addons $ npm i nan $ touch hello.cpp binding.gyp test.js hello.cpp #include <node.h> using v8::Funct
阅读全文
posted @ 2019-02-09 14:43
Ajanuw
摘要:"原文链接 https://www.cnblogs.com/ajanuw/p/10324269.html " "Request" "Response" "page.setRequestInterception(true)" 开启拦截 "req.respond()" 返回一个自定义响应 "req.co
阅读全文
摘要:main.js index.html run
阅读全文
摘要:"模式模拟GraphQL数据" const { ApolloServer, gql } = require('apollo server'); const typeDefs = gql` type Query { hello: Float resolved: String } `; const re
阅读全文
摘要:"阿波罗服务器入门" const { gql, ApolloServer } = require("apollo server"); const _ = require("lodash"); const cats = [{ id: 1, name: "a" }, { id: 2, name: "b"
阅读全文
摘要:$ cd <project-root-path> 进入项目根目录 $ npm run build $ pm2 start npm --name <name> -- run start:prod pm2基本命令 $ npm install pm2 -g # 命令行安装 pm2 $ pm2 start
阅读全文
posted @ 2018-11-12 22:34
Ajanuw