[英]How to deliver a node.js + imagemagick tool?
我已經開發了一個node.js工具,該工具從命令行使用了imagemagick。 即exec('my_imagemagick_commands')
。 使用Windows將該工具交付給客戶端的最佳方法是什么? 也就是說,我如何制作一個Windows安裝程序來將node.js,imagemagick和該工具(最好是二進制文件而不是源文件)安裝在特定文件夾中?
如果您想要一個簡單的捆綁包...請壓縮以下列表,在客戶端上部署並將圖像拖放到待處理的yourtool.cmd文件中(我正在為圖像優化器做類似的事情)
捆綁包:(將它們放在一個目錄中)
yourtool.cmd
REM Get the drive/path the batch file is in
set batchdir=%~d0%~p0
REM Run tool for items dragged over...
"%batchdir%node.exe" "%batchdir%yourtool.js" %*
yourtool.js
// start at 2 for arguments passed...
// 0 is node.exe
// 1 is the js file run
for (var i=2; i<process.argv.length; i++) {
var imagePath = process.argv[i];
//do something with image...
}
對於其他對帶有節點的imagemagick感興趣的人,您應該查看node-imagemagick
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.