node-webkit

Progress bar based on file download

久未见 提交于 2019-12-03 09:01:06
How would I display a progress bar based on file downloaded in node webkit? var https = require('https'); var fs = require('fs'); var exec = require('child_process').exec; var file = fs.createWriteStream("update_setup.exe"); var len = 0; var request = https.get(url + 'appdata/update_setup.exe', function (response) { response.pipe(file); response.on('data', function (chunk) { file.write(chunk); len += chunk.length; var percent = (len / response.headers['content-length']) * 100; }); file.on('finish', function () { setTimeout(function () { win.close(); exec('update_setup.exe'); }, 1000); }); });

How to achieve persistent storage in NeDB?

时光毁灭记忆、已成空白 提交于 2019-12-03 08:40:27
I tried NeDB in node-webkit it's working fine on in memory data but not able to store in persistent storage. definitely no node-webkit or nedb expert but this is how I did it and it worked. As already mentioned by mvanderw in the comments, definitely make sure to check the autoload option. This is for example my configuration for a simple node-webkit/ angular todo app: var Datastore = require('nedb'), path = require('path'), db = new Datastore({ filename: path.join(require('nw.gui').App.dataPath, 'todo.db'), autoload: true }); When I restart the app, all todos are still there and I'm ready to

How to package a NW.js application on Windows

巧了我就是萌 提交于 2019-12-03 03:44:49
I am reading the instructions for how to package a NW.js app and the wording is a confusing mess and makes no sense. I highlighted the contradictory word-salad parts. Create a zip file (this is built into XP, Vista and 7) Copy all of your files into the zip file , retaining directory structure and making sure that the package.json file is in the root directory (if you make a zip file containing a folder with your stuff in it, then it's not going to work ) Rename the file extension from .zip to .nw. By default, file extensions may be hidden. You need to (press alt), go to folder options and

How to open a browser window from a node-webkit app?

馋奶兔 提交于 2019-12-03 02:06:11
I have a desktop application, packaged using node-webkit. I need to open the default browser of the user on click of a link. I am using window.open("www.google.com") but this opens a new node-webkit window rather than opening a browser window. How do I open a browser window instead?? To open a link in the user's default browser, you could use gui.Shell.openExternal("http://website.com") . Checkout the documentation for gui.Shell . 来源: https://stackoverflow.com/questions/19157659/how-to-open-a-browser-window-from-a-node-webkit-app

Node-webkit app- how to update it?

若如初见. 提交于 2019-12-03 01:53:45
I am using node-webkit to develop apps for my students, and to provide one stop solution I would need to update node-webkit archive once in a month. Is there a way I can accomplish that? Basically I need to replace just one html file every month, say "page1.html". I googled but have no idea where to start. On Mac, you can access the filesystem of the own app e.g. $ ls -lh /Applications/Shock.app/Contents/Resources/app.nw/ [...] -rw-r--r-- 1 jordi staff 2,3K 29 gen 01:47 index.html -rw-r--r-- 1 jordi staff 467B 29 gen 01:47 lecturenotes.html [...] So if you put a new version on a specific URL,

securing the source code in a node-webkit desktop application

假装没事ソ 提交于 2019-12-02 20:46:45
first things first , i have seen nwsnapshot . and its not helping. i am building an inventory management system as a desktop app using node-webkit . the project being built is using compoundjs (mvc javascript library). which have a definite folder structure (you know mvc) and multiple javascript files inside them. the problem is nwsnapshot allows the app to have only a single snapshot file but the logic of application is spread over all the folders in different javascript files. so how do i secure my source code before shipping it to client? Or any other work-around Or smarter way (yes, i know

基于node-webkit 开发的桌面应用实例

那年仲夏 提交于 2019-12-02 10:16:38
1、下载 node-webkit : https://github.com/nwjs/nw.js 文件目录如下: 2:在该文件目录下新建package.json( 如果存在该文件请直接编写如下代码 ), 一个最简单的内容如下( ps:注释代码请删除 ): { "main": "index.html", //程序的读入文件 "name": "sample-app", //名称的内容顺便写 "window": { "toolbar": false, //是否允许出现菜单栏 "resizable": false, //是否允许拖动窗口大小 "width": 370, //窗口的宽 "height": 220 //窗口的高 } } 3、在该目录下新建index.html, html文件部分代码: <h1>hello webkit</h1> 4、双击运行nw.exe; 5、效果图: -- node-webkit:具有nodejs的本地文件的操作能力,也有对页面的渲染功能;不得不佩服谷歌的强大 来源: oschina 链接: https://my.oschina.net/u/1861097/blog/414101

node-webkit:开发桌面+WEB混合型应用的神器

自闭症网瘾萝莉.ら 提交于 2019-12-02 10:16:22
大漠穷秋 2014-01-31 bla...bla... 顾名思义,node-webkit就是nodejs+webkit。 这样做的好处显而易见,核心奥义在于,用nodejs来进行本地化调用,用webkit来解析和执行HTML+JS。 快速上手 下载node-webkit 点击这里: https://github.com/rogerwang/node-webkit 找到Downloads这一小节,然后下载对应平台的node-webkit预编译包。(为了介绍起来方便,本文后续内容全部针对windows平台,OSX和linux平台上的操作类似,就不做特意说明了。) 下载完之后解压,可以看到如下内容: 双击nw.exe直接运行,看到如下界面说明一切都ok,在你的机器上可以运行: Hello nw 老规矩,先来Hello World! 建一个example1.html,内容如下: <!DOCTYPE html> <html> <head> <title>Hello World!</title> </head> <body> <h1>Hello node-webkit!</h1> We are using node.js <script>document.write(process.version)</script>. </body> </html> 在同一级目录下再建一个package

关于node-webkit安装程序制作的另一种办法

别来无恙 提交于 2019-12-02 10:16:03
node-webkit是一个让我们很方便的利用node和webkit内核,前后团都用js,轻松方便的开发出c端应用程序的技术,多余的介绍不必多说,需要详细制动的请大家自行google, 我这里说一下安装程序的制作,由于node-webkit 以下简称nw 是作者编译好的nw.exe来启动的,所以应用程序文件是一大堆node结构的文件和文件夹,其实就是一堆固定目录结构的html结合js,css文件,nw.exe根据程序描述文件package.json来启动主页面加载到webkit内核中的.作者介绍了,两种安装程序的制作方法,第一种是把所有文件都压缩到一个exe中,这样所有程序多作为一个exe执行,但是很多网友都反映,这样制作出的程序往往很大,nw.exe本身及其所用的文件就30+m呢,另一种就是用参数的方法来运行,其参数是 nw.exe 程序路径, 对就这么简单 这种方式可以不用费劲的去打包那些庞大的安装文件,只需要把nw.exe 与程序文件拷贝到一个地方,然后给用户建一个快捷方式指向这个命令就可以用了, 我在网上寻寻觅觅的找到了inno setup 这个安装程序制作软件 过程很简单,我贴出主要步骤 在选择文件这一步,要选择nw.exe为程序的执行文件 下面选择文件 单击 add files 按钮把 nw.exe相关文件都选进来 单击 add folder按钮 把程序的主目录选中

使用node-webkit开发exe窗口程序

放肆的年华 提交于 2019-12-02 10:15:52
首发: 个人博客,更新&纠错&回复 ====关于原生程序与壳中程序的议论begin==== 在所有用户windows机器上都能直接跑的程序,如果不采用微软系的语言,如VB,C++,C#等,而采用Java,Python,Ruby之类的语言开发,最终的结果在体积上一定远大于微软系语言开发的程序,因为这些语言不具备直接生成exe执行文件的能力,都需要额外的中间层来提供环境,而这个中间层的体积往往不小。 最直观的道理就是,java程序只能在装有java虚拟机的机器上跑,如果你想突破这个限制,让它跑在任何一台机器上,那你必须把虚拟机打包在你的程序里一并提供给用户,最终还是改变不了要跑在虚拟机里的命运,唯一的好处是不用客户手动安装虚拟机了,其他语言同理。 这就是原生程序与加壳程序的区别,原生程序的优点在针对特定平台编译,体积小,速度快,而加壳程序因为必须把壳引入到用户机器中,体积臃肿,加壳程序的优点在可以用程序员自己舒服的语言开发,而且甚至可以跨平台开发——发布的时候针对不同的平台加不同的壳就OK了,java的招牌式口号“一次编写,处处运行”前提正是其程序都是壳中程序,不同的壳(即java虚拟机)向上暴露的接口都是一样的,这样壳中程序可以在安稳的环境中编写。 在微软系的语言中.NET是个有意思的角色,严格讲它编写出的程序也是壳中程序,但这个壳是微软的“官方壳”,不管你用到的第一个使用