草庐IT

why-is-node-running

全部标签

javascript - node.js child_process.spawn 没有标准输出,除非 'inherit'

我正在尝试从node.js(0.10.29)中的spawnedchild_process捕获标准输出。现在我只是尝试使用ping以下代码不打印(但执行ping)varexec=require('child_process').exec;varspawn=require('child_process').spawn;varutil=require('util')varping=spawn('ping',['127.0.0.1'],{stdio:'pipe'});ping.stdout.on('data',function(data){util.print(data);})ping.std

javascript - 将文件上传到node.js中的ftp服务器

我正在尝试使用node.js在ftp服务器上上传文件,如下所示-我正在使用库-https://github.com/sergi/jsftpvarfs=require('fs');varFtp=newJSFtp({host:"ftp.some.net",port:21,//defaultsto21user:"username",//defaultsto"anonymous"pass:"pass",debugMode:true//defaultsto"@anonymous"});正在上传文件-exports.UploadToFtP=function(req,res){Ftp.put('pu

javascript - 在 Node.js 中使用 Jasmine 测试子 process.send

我有一个Node.js应用程序,它有一个main-process.js和一个child-process.js。main-process.js看起来像这样:varchildProcess=require('child_process');varjob=childProcess.spawn('node',["child-process.js"],{detached=true,stdio:['ipc']});我的child-process.js执行一些任务并通知父进程它的状态,它使用:exports.init=function(){//someprocessinghereprocess.se

javascript - node.js 模块和函数中 "this"的含义

我有一个由require加载的JavaScript文件。//loadedbyrequire()vara=this;//"this"isanemptyobjectthis.anObject={name:"Anobject"};varaFunction=function(){varinnerThis=this;//"this"isnodeglobalobject};aFunction();(function(anyParameter){console.log(anyParameter.anObject);})(this//"this"issamehavinganObject.Not"glo

javascript - 将缓冲区图像数据管道化为 Node.js 中的 Uint8ClampedArray 格式

我正在尝试将图像数据传输到我已在浏览器中成功使用的函数中。浏览器中的代码如下:varmyImageData=context.getImageData(0,0,width,height);vargray=tracking.Image.grayscale(myImageData.data,width,height);这工作得很好,据我所知似乎正在生成一个ImageDatacanvas中图像中的对象..dataImageData的属性(property)对象似乎是Uint8ClampedArray上面写着[r1,g1,b1,a1,r2,g2,b2,a2.....]查看模式,每四个数字是255

javascript - Youtube 嵌入视频产生错误 "ytcfg is not defined"

如果页面上嵌入了youtube视频,浏览器控制台会出现以下错误消息:注意:没有API用于嵌入,例如YoutubeiFrameAPI-只是一个原始的iframe。它也可以在youtube网站上重现,如果您转到某个视频,单击“共享”按钮并选择“嵌入”选项卡。或者只是在新的浏览器窗口中打开一些视频链接,例如https://www.youtube.com/embed/.....对于这个错误消息,我能做些什么吗? 最佳答案 它在他们自己的网站上也坏了https://developers.google.com/youtube/youtube_p

javascript - 剧情 js : how to run my javascript ONLY after plot image is loaded

当通过JavascriptAPI(plotly.js,而不是plotly-nodejs)使用任何类型的plotly图表时,我如何才能在图表加载后运行一些javascript?我正在寻找plotlyjavascriptAPI中的机制,例如,在使用GoogleMapsAPI时,它与“addListenerOnce”结合“tilesloaded”或“ready”执行相同的操作。例如,假设我想在呈现https://plot.ly/~PlotBot/685处显示的示例后立即简单地显示一个警报,其html和js代码可以在https://plot.ly/~PlotBot/685.js查看.这样做的原

javascript - 错误 : 'jQuery is not defined'

我用jQuery写了一个脚本。它适用于Firefox和GoogleChrome。只有在IE中我才返回这个错误:'jQuery'isnotdefinedjquery-ui-1.8.4.custom.min.js,Row10Character1这是我页面的头部:Contattaci-TheItalianBrand.com$(function(){$('#dialog_link,ul#iconsli').hover(function(){$(this).addClass('ui-state-hover');},function(){$(this).removeClass('ui-state-

javascript - Angular JS : Uncaught DOMException: Failed to execute 'removeChild' on 'Node' on HTMLScriptElement. 回调

我正在使用AngularJSONHttp调用。同样,当我发出这样的帖子请求时:app.service('AjaxService',['$http','$q','$sce',function($http,$q,$sce){return{getSearchResultsJSONP:function(){varurl="http://stage-sp1004e4db.guided.lon5.atomz.com/?searchType=globalsearch&q=this&sp_staged=1&callback=JSON_CALLBACK";$sce.trustAsResourceUrl(

javascript - 类型错误 : 'undefined' is not an object

我有一个目前相当不正常的Javascript程序,它一直给我带来问题。但是,它引发了一个我不明白的错误:TypeError:'undefined'isnotanobject(evaluating'sub.from.length')正如您可能猜到的那样,我正在尝试做的是检查lengthfrom中的某个“sub”数组字典。这是sourcecodefortheentirefunction,这是我认为导致错误的循环代码:console.log(afcHelper_ffuSubmissions.length);//justfordebugging,returnsthecorrectnumberf