简体   繁体   English

如何在TypeScript / JavaScript中调用node.js脚本?

[英]How to invoke a node.js script in TypeScript / JavaScript?

I have a node.js script under /bin folder. 我在/bin文件夹下有一个node.js脚本。 The script is a command line tool that generates png files. 该脚本是生成png文件的命令行工具。 I use it as $ node vl2png [input_file_name] [output_file_name] 我将其用作$ node vl2png [input_file_name] [output_file_name]

I have a gallery.ts file which will populate an online gallery. 我有一个gallery.ts文件,它将填充在线画廊。 I want to use the pngs generated by the vl2png script in my gallery. 我想使用pngsvl2png脚本生成的vl2png What's the best way to call the node script in my gallery.ts file? gallery.ts文件中调用节点脚本的最佳方法是什么?

您可以编译gallery.ts以获得gallery.js ,然后使用node运行它,也可以安装ts-node并运行ts-node gallery.ts

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM