Re: [nodejs] NodeJS ReadStream not reading bufferSize bytes at a time
I think this is related: https://github.com/joyent/node/issues/2098 - Gill On Thursday, 2 August 2012 23:32:39 UTC-7, Gill wrote: > > Ben, thanks for the reply. I have a doubt that its just a hint, because > how come it is exactly 40960 bytes every time. The underlying filesystem is > a custom coded one, which WILL return the exact number of bytes that were > asked for. Line 38 for /lib/fs.js says: > > var kPoolSize = 40 * 1024; > > Do you think changing it to 128 * 1024 will change anything? > > - Gill > > On Thursday, 2 August 2012 16:29:43 UTC-7, Ben Noordhuis wrote: >> >> On Thu, Aug 2, 2012 at 9:21 PM, Gill wrote: >> > I have a code where the NodeJS server reads a file and streams it to >> > response, it looks like: >> > >> > var fStream = fs.createReadStream(filePath, {'bufferSize': 128 * >> 1024}); >> > fStream.pipe(response); >> > >> > The issue is, Node reads the file exactly 40960 bytes a time. However, >> my >> > app would be much more efficient (due to reasons not applicable to this >> > question), if it reads 131072 (128 * 1024) bytes at a time. >> > >> > Is there a way to force Node to read 128 * 1024 bytes at a time from >> the >> > stream? >> > >> > Thanks in advance! >> >> No. bufferSize is a hint, not an imperative. It's up to the operating >> system to honor it. >> > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Simple Memcached server in Javascript with 100 lines of code
Hi guys, I am studying node.js. It is a wonderful utility to write network-based application. Now, I have written a memcached server using node.js. You can have a look at https://gist.github.com/3244607 I tested the program, and found it could reach 12000/s throughput. However, during the test, I found sometimes the speed suddenly decreased due to the GC pause from my mind. Is there a way to improve my code ? Thanks Junyi -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] NodeJS ReadStream not reading bufferSize bytes at a time
Nathan, Its not about how the bytes are written, its more about how they are read. I guess the BlockStream just writes them one block at a time, but the underlying fs.createreadstream will still read them at 40960 bytes a time. - Gill On Thursday, 2 August 2012 18:52:34 UTC-7, Nathan Rajlich wrote: > > You may want to check out "block-stream" if you require buffers in > specific chunk sizes: https://npmjs.org/package/block-stream > > On Thu, Aug 2, 2012 at 4:29 PM, Ben Noordhuis wrote: > >> On Thu, Aug 2, 2012 at 9:21 PM, Gill wrote: >> > I have a code where the NodeJS server reads a file and streams it to >> > response, it looks like: >> > >> > var fStream = fs.createReadStream(filePath, {'bufferSize': 128 * 1024}); >> > fStream.pipe(response); >> > >> > The issue is, Node reads the file exactly 40960 bytes a time. However, >> my >> > app would be much more efficient (due to reasons not applicable to this >> > question), if it reads 131072 (128 * 1024) bytes at a time. >> > >> > Is there a way to force Node to read 128 * 1024 bytes at a time from the >> > stream? >> > >> > Thanks in advance! >> >> No. bufferSize is a hint, not an imperative. It's up to the operating >> system to honor it. >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to nodejs@googlegroups.com >> To unsubscribe from this group, send email to >> nodejs+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> > > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] NodeJS ReadStream not reading bufferSize bytes at a time
Ben, thanks for the reply. I have a doubt that its just a hint, because how come it is exactly 40960 bytes every time. The underlying filesystem is a custom coded one, which WILL return the exact number of bytes that were asked for. Line 38 for /lib/fs.js says: var kPoolSize = 40 * 1024; Do you think changing it to 128 * 1024 will change anything? - Gill On Thursday, 2 August 2012 16:29:43 UTC-7, Ben Noordhuis wrote: > > On Thu, Aug 2, 2012 at 9:21 PM, Gill wrote: > > I have a code where the NodeJS server reads a file and streams it to > > response, it looks like: > > > > var fStream = fs.createReadStream(filePath, {'bufferSize': 128 * 1024}); > > fStream.pipe(response); > > > > The issue is, Node reads the file exactly 40960 bytes a time. However, > my > > app would be much more efficient (due to reasons not applicable to this > > question), if it reads 131072 (128 * 1024) bytes at a time. > > > > Is there a way to force Node to read 128 * 1024 bytes at a time from the > > stream? > > > > Thanks in advance! > > No. bufferSize is a hint, not an imperative. It's up to the operating > system to honor it. > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] actionHero Version 3: Websockets and more!
Hello Node.js Community - I want to announce the release of actionHero version 3. This release adds web socket support as a first-class protocol (via socket.io) as well as improvements to the task system. actionHero is an API framework which makes is possible to serve up http(s), webcocket, and direct TCP clients. It features clustering and message passing (based on redis), 'chat room' logic, and a built-in delayed-job processing engine. Check it out here [[ http://actionherojs.com/ ]]. I always welcome feedback! -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Last day to buy NodeConf SummerCamp tickets
Just got our 3 tickets. Thanks for the heads up. On Thursday, August 2, 2012 4:53:10 PM UTC-4, Mikeal Rogers wrote: > > We need to get a final count to the camp so this will be probably be the > last day that you can buy SummerCamp tickets. > > Come join me, dshaw, Paolo, isaacs, tmpvar, Max Ogden, Charlie Robbins and > a ton of other people in the woods geeking out about node.js :) > > https://tito.io/nodeconf/nodeconf-summercamp > > Tickets include all your meals and lots of beers the whole time :) > > -Mikeal -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] NodeJS ReadStream not reading bufferSize bytes at a time
You may want to check out "block-stream" if you require buffers in specific chunk sizes: https://npmjs.org/package/block-stream On Thu, Aug 2, 2012 at 4:29 PM, Ben Noordhuis wrote: > On Thu, Aug 2, 2012 at 9:21 PM, Gill wrote: > > I have a code where the NodeJS server reads a file and streams it to > > response, it looks like: > > > > var fStream = fs.createReadStream(filePath, {'bufferSize': 128 * 1024}); > > fStream.pipe(response); > > > > The issue is, Node reads the file exactly 40960 bytes a time. However, my > > app would be much more efficient (due to reasons not applicable to this > > question), if it reads 131072 (128 * 1024) bytes at a time. > > > > Is there a way to force Node to read 128 * 1024 bytes at a time from the > > stream? > > > > Thanks in advance! > > No. bufferSize is a hint, not an imperative. It's up to the operating > system to honor it. > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: capsule or similar (node, socketio, mongo, backbone
On Aug 2, 2:11 pm, "john.tiger" wrote: > has anyone used this (it seems dated and not upgraded) or something > similar ? idea being backbone on client with node, socket.io, and mongo > without all the baggage and maint of a server side framework There's backbone.io: https://github.com/MiLk/backboneio I personally haven't used it yet though. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Memory usage, how to garbage collect
On Thu, Aug 2, 2012 at 8:37 PM, Ben Buckman wrote: > Suppose I have a very large array in memory and want to clear it after it's > no longer needed. This snippet replicates the scenario: > > console.log("Memory usage initial:", process.memoryUsage()); > > var hugeStack = [], i, obj; > > function longRandomString(){ > return Math.random().toString(7) + Math.random().toString(7) + > Math.random().toString(7) + Math.random().toString(7); > } > > for (i = 0; i < 1000; i++) { > obj = { > a: longRandomString(), > b: longRandomString(), > c: longRandomString() > }; > hugeStack.push(obj); > } > > console.log("Memory usage with full stack:", process.memoryUsage()); > > hugeStack = []; > obj = null; > delete hugeStack, obj; > > console.log("Memory usage with cleared stack:", process.memoryUsage()); > > > I would expect the last memoryUsage() report to drop significantly from the > 2nd one, close to the initial level - but it just keeps going up. > What's the proper way to clear up this memory usage? Make sure all references to the array are gone and V8 will sooner or later reclaim the memory. Don't look at RSS or virtual memory size, they're hardly relevant for managed applications. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] NodeJS ReadStream not reading bufferSize bytes at a time
On Thu, Aug 2, 2012 at 9:21 PM, Gill wrote: > I have a code where the NodeJS server reads a file and streams it to > response, it looks like: > > var fStream = fs.createReadStream(filePath, {'bufferSize': 128 * 1024}); > fStream.pipe(response); > > The issue is, Node reads the file exactly 40960 bytes a time. However, my > app would be much more efficient (due to reasons not applicable to this > question), if it reads 131072 (128 * 1024) bytes at a time. > > Is there a way to force Node to read 128 * 1024 bytes at a time from the > stream? > > Thanks in advance! No. bufferSize is a hint, not an imperative. It's up to the operating system to honor it. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: "Standard" Test Runner for Node
Hi, You might be interested in checking out BusterJS. It's a testing framework that allows you to test your code in both browsers and Node. Also has a lot of functions, so might be something you can use ^_^ http://busterjs.org/ Regards, Arne On Monday, July 16, 2012 6:56:14 PM UTC+2, Alex Young wrote: > > Hello, > > I write about Node a lot, and I often illustrate concepts using tests. > However, there isn't a standard test runner for Node. > > So, let's say I'm writing a book about Node. I'd like to include examples > using a test runner that's idiomatic, lightweight, and likely to be around > in a year or two. I'm thinking Mocha or Nodeunit might be a good idea. > > My projects from 2010-2011 seemed to use Nodeunit, and I've switched a few > to Mocha with very little trouble. Their APIs aren't directly compatible > but the same concepts can be readily gleaned in both. > > Does anyone have any strong opinions about this? What test runner would > you expect (or want) to see in books about Node? > > Thanks, > > Alex > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] NodeJS ReadStream not reading bufferSize bytes at a time
I have a code where the NodeJS server reads a file and streams it to response, it looks like: var fStream = fs.createReadStream(filePath, {'bufferSize': 128 * 1024}); fStream.pipe(response); The issue is, Node reads the file exactly 40960 bytes a time. However, my app would be much more efficient (due to reasons not applicable to this question), if it reads 131072 (128 * 1024) bytes at a time. Is there a way to force Node to read 128 * 1024 bytes at a time from the stream? Thanks in advance! -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Most efficient way of piping HTTP body through a tunneling proxy
Hi axs, +1 for request. It will help you massively on the client side. I tried to do what you're doing a few weeks ago so I could use SSH in cafes. I found that I had to do write a blank string into the http stream on the client side to force request to send the request headers though. However, I think request's 'data' event might give you a String, not a Buffer. This means that any binary data might get corrupted. You can get round that by making a base64 stream encoder and decoder, but they have to pass binary data around as Buffer objects and not strings - stringstream didn't work for me. Another problem you might get is that some firewalls might make sure that your full request is sent to the server before any response is delivered, which would prevent streaming. For instance, vodafone's 3g content filter will block that implementation. Here is my solution: https://github.com/johncant/node-http-tunnel The client polls the server 5 times a second, and they relay all the Stream events to eachother, keeping track of the streams. Gets through most unhardcore firewalls. Unfortunately it still gets blocked by McAfee's firewall, so I can't use it in my local library :( In the end I just gave up and worked from somewhere devoid of technophobic luddites :) John On Monday, July 30, 2012 10:18:38 PM UTC+1, axs wrote: > > I'm making an http proxy that tunnels data at the transport layer. Here is > the complete code: > > var http = require('http'); > var net = require('net'); > var url = require('url'); > > var proxy = http.createServer(); > > // proxy an HTTP request > proxy.on('request', function(req, res){ > var uri = url.parse(req.url); > var httpMessage = req.method + ' ' + uri.path + ' HTTP/'+ > req.httpVersion + '\r\n'; > for(var header in req.headers){ > httpMessage += header + ': ' + req.headers[header] + '\r\n'; > } > httpMessage += '\r\n'; > req.on('data', function(data){ > httpMessage += data; > }); > req.on('end', function(data){ > httpMessage += data; > var client = net.connect(uri.port || 80, uri.hostname, function(){ > client.write(httpMessage); > client.pipe(req.connection); > req.connection.pipe(client); > }); > }); > }); > > // proxy an HTTPS request > proxy.on('connect', function(req, socket, head) { > var uri = req.url.split(':') > var tunnel = net.connect({ > port: uri[1], > host: uri[0] > }, function() { > socket.write('HTTP/1.1 200 Connection Established\r\n\r\n'); > tunnel.write(head); > tunnel.pipe(socket); > socket.pipe(tunnel); > }); > }); > > proxy.listen(8080); > > My question has to do with http proxy section: I haven't run into this > problem yet, but I can see that for potentially large HTTP bodies (such as > file transfers), httpMessage may dramatically increase in size. What is the > best way to pipe this data over the client tcp socket as it comes in, > instead of caching the whole thing and sending all at once? Would be even > better if I could just pipe all the parts of the HTTP message (request > line, headers, body, ...) as they come into the server. > > Thank for any help in advance. > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Version 0.8.5 (Stable)
2012.08.02, Version 0.8.5 (Stable) * node: tag Encode and friends NODE_EXTERN (Ben Noordhuis) * fs: fix ReadStream / WriteStream missing callback (Gil Pedersen) * fs: fix readFileSync("/proc/cpuinfo") regression (Ben Noordhuis) * installer: don't assume bash is installed (Ben Noordhuis) * Report errors properly from --eval and stdin (isaacs) * assert: fix throws() throws an error without message property (koichik) * cluster: fix libuv assert in net.listen() (Ben Noordhuis) * build: always link sunos builds with libumem (Trent Mick) * build: improve armv7 / hard-float detection (Adam Malcontenti-Wilson) * https: Use host header as effective servername (isaacs) * sunos: work around OS bug to prevent fs.watch() from spinning (Bryan Cantrill) * linux: fix 'two watchers, one path' segfault (Ben Noordhuis) * windows: fix memory leaks in many fs functions (Bert Belder) * windows: don't allow directories to be opened for writing/appending (Bert Belder) * windows: make fork() work even when not all stdio handles are valid (Bert Belder) * windows: make unlink() not remove mount points, and improve performance (Bert Belder) * build: Sign pkg installer for OS X (isaacs) Source Code: http://nodejs.org/dist/v0.8.5/node-v0.8.5.tar.gz Macintosh Installer (Universal): http://nodejs.org/dist/v0.8.5/node-v0.8.5.pkg Windows Installer: http://nodejs.org/dist/v0.8.5/node-v0.8.5-x86.msi Windows x64 Installer: http://nodejs.org/dist/v0.8.5/x64/node-v0.8.5-x64.msi Windows x64 Files: http://nodejs.org/dist/v0.8.5/x64/ Other release files: http://nodejs.org/dist/v0.8.5/ Website: http://nodejs.org/docs/v0.8.5/ Documentation: http://nodejs.org/docs/v0.8.5/api/ Shasums: ``` 74b470d04c3dac9f5838d4ed61e2fb50e394114a node-v0.8.5-x86.msi 28280575b717306b34440c83aace720dccc3047f node-v0.8.5.pkg 835ba5ca429e56f65aeb1a5d9730fff105e86337 node-v0.8.5.tar.gz c8ce66eefd6d75b44cdf29bb49aeffe4ea534b7f node.exe d3832fb5a7a45d739c9d3faa7e13115bdaaa9cc7 node.exp 5dee595f12dbfdee14b6e8aebc07a77ee96e5e45 node.lib ac62ec2d2508dfcd0c2f5cfcf725286ad876fb7a node.pdb 12876d80668b066b460833d096998525d8eceec7 npm-1.1.46.tgz 4e820e5a99512e194ec30878ede08488211c8391 npm-1.1.46.zip 95882b6aeab74725197b10d31ff4ee3a0723574c x64/node-v0.8.5-x64.msi 9d9c0652e57e05708b59bba78a55bc1237fcfb73 x64/node.exe f13f377c432c5a8fb4661abaae3a07c46ac74a66 x64/node.exp a17e3e8742ac084e1f7f99f721470e9d6182e75f x64/node.lib 4026170fed5a55fad6ee569daa9666cbb9d5ae3d x64/node.pdb ``` -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Last day to buy NodeConf SummerCamp tickets
We need to get a final count to the camp so this will be probably be the last day that you can buy SummerCamp tickets. Come join me, dshaw, Paolo, isaacs, tmpvar, Max Ogden, Charlie Robbins and a ton of other people in the woods geeking out about node.js :) https://tito.io/nodeconf/nodeconf-summercamp Tickets include all your meals and lots of beers the whole time :) -Mikeal -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] https, GoDaddy SSL cert, node.js under Microsoft Azure
Thank you. Will look at it. Don't feel very comfortable using it with a password that way. On Thursday, August 2, 2012 8:33:17 AM UTC-7, Ben Noordhuis wrote: > > On Thu, Aug 2, 2012 at 5:27 PM, thstart wrote: > > Install GoDaddy SSL certificate with Node.js > > > > I want to use https for my web app which is running on Microsoft > > Azure. > > > > I used IIS to generate certificate for GoDaddy then downloaded two > files: > > .crt > > gd_iis_intermediates.p7b > > Then I followed procedures described in GoDaddy to export and password > > protect my .pfx certificate. Uploaded to MS Azure now my > site > > is serving https only. > > > > Now I need to use https.createServer(options, [requestListener]) as > > described in: > > http://nodejs.org/api/https.html > > > > // curl -k https://localhost:8000/ > > var https = require('https'); > > var fs = require('fs'); > > > > var options = { > > key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), > > cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem') > > }; > > > > https.createServer(options, function (req, res) { > > res.writeHead(200); > > res.end("hello world\n"); > > }).listen(8000); > > > > > > > > There is not a key when I am using IIS so I have to extract > > it from the .pfx and remove the password or to use the .pfx > > directly (which needs a password). How is the right way to > > handle this? > > > > > > var https = require('https'); > > var fs = require('fs'); > > > > var options = { > > pfx: fs.readFileSync('server.pfx') > > }; > > > > https.createServer(options, function (req, res) { > > res.writeHead(200); > > res.end("hello world\n"); > > }).listen(8000); > > You probably need to pass in a pass phrase. Have a look at the test case: > > https://github.com/joyent/node/blob/50e00de/test/simple/test-https-pfx.js > On Thursday, August 2, 2012 8:33:17 AM UTC-7, Ben Noordhuis wrote: > > On Thu, Aug 2, 2012 at 5:27 PM, thstart wrote: > > Install GoDaddy SSL certificate with Node.js > > > > I want to use https for my web app which is running on Microsoft > > Azure. > > > > I used IIS to generate certificate for GoDaddy then downloaded two > files: > > .crt > > gd_iis_intermediates.p7b > > Then I followed procedures described in GoDaddy to export and password > > protect my .pfx certificate. Uploaded to MS Azure now my > site > > is serving https only. > > > > Now I need to use https.createServer(options, [requestListener]) as > > described in: > > http://nodejs.org/api/https.html > > > > // curl -k https://localhost:8000/ > > var https = require('https'); > > var fs = require('fs'); > > > > var options = { > > key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), > > cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem') > > }; > > > > https.createServer(options, function (req, res) { > > res.writeHead(200); > > res.end("hello world\n"); > > }).listen(8000); > > > > > > > > There is not a key when I am using IIS so I have to extract > > it from the .pfx and remove the password or to use the .pfx > > directly (which needs a password). How is the right way to > > handle this? > > > > > > var https = require('https'); > > var fs = require('fs'); > > > > var options = { > > pfx: fs.readFileSync('server.pfx') > > }; > > > > https.createServer(options, function (req, res) { > > res.writeHead(200); > > res.end("hello world\n"); > > }).listen(8000); > > You probably need to pass in a pass phrase. Have a look at the test case: > > https://github.com/joyent/node/blob/50e00de/test/simple/test-https-pfx.js > On Thursday, August 2, 2012 8:33:17 AM UTC-7, Ben Noordhuis wrote: > > On Thu, Aug 2, 2012 at 5:27 PM, thstart wrote: > > Install GoDaddy SSL certificate with Node.js > > > > I want to use https for my web app which is running on Microsoft > > Azure. > > > > I used IIS to generate certificate for GoDaddy then downloaded two > files: > > .crt > > gd_iis_intermediates.p7b > > Then I followed procedures described in GoDaddy to export and password > > protect my .pfx certificate. Uploaded to MS Azure now my > site > > is serving https only. > > > > Now I need to use https.createServer(options, [requestListener]) as > > described in: > > http://nodejs.org/api/https.html > > > > // curl -k https://localhost:8000/ > > var https = require('https'); > > var fs = require('fs'); > > > > var options = { > > key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), > > cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem') > > }; > > > > https.createServer(options, function (req, res) { > > res.writeHead(200); > > res.end("hello world\n"); > > }).listen(8000); > > > > > > > > There is not a key when I am using IIS so I have to extract > > it from the .pfx and remove the password or to use the .pfx > > directly (which needs a password). How is the right way to > > h
[nodejs] Memory usage, how to garbage collect
Suppose I have a very large array in memory and want to clear it after it's no longer needed. This snippet replicates the scenario: console.log("Memory usage initial:", process.memoryUsage()); var hugeStack = [], i, obj; function longRandomString(){ return Math.random().toString(7) + Math.random().toString(7) + Math.random().toString(7) + Math.random().toString(7); } for (i = 0; i < 1000; i++) { obj = { a: longRandomString(), b: longRandomString(), c: longRandomString() }; hugeStack.push(obj); } console.log("Memory usage with full stack:", process.memoryUsage()); hugeStack = []; obj = null; delete hugeStack, obj; console.log("Memory usage with cleared stack:", process.memoryUsage()); I would expect the last memoryUsage() report to drop significantly from the 2nd one, close to the initial level - but it just keeps going up. What's the proper way to clear up this memory usage? Thanks! -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] capsule or similar (node, socketio, mongo, backbone
has anyone used this (it seems dated and not upgraded) or something similar ? idea being backbone on client with node, socket.io, and mongo without all the baggage and maint of a server side framework thks for any insight -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: [RFC] Sandbox Module.
It broke in 0.7.x, have not had time to get it running again. On Thursday, August 2, 2012 3:01:17 AM UTC-5, Tim wrote: > > Bradley, what's the status of this? > > I was looking at extending the Sandbox framework a little by providing a > dumbed down require() and wrappers for things like fs that enforce > restrictions on paths etc. > > > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] string encoding
Thank's Dominic! It works! четверг, 2 августа 2012 г., 19:17:52 UTC+4 пользователь Dominic написал: > > try removing whitespace from the ends > > text = text.trim() > > On Thu, Aug 2, 2012 at 3:24 PM, Dan Milon wrote: > > for me, text is "exit\n" > > I guess you are on windows, so text is "exit\r\n" > > > > The readline module might help you. > > > > > > On 08/02/2012 04:15 PM, Danil Gazizov wrote: > >> > >> I'm confused of how to compare string const with variable. > >> Look at this simple example where keyboard input compares with const > >> string. > >> I suggest this is encoding problem. Please, tell me what should be done > to > >> exit process ? > >> File encoding is utf8 > >> > >> process.stdin.setEncoding();//default is utf-8 > >> process.stdin.resume(); > >> process.stdin.on("data", function(text) { > >> > >> //shows entered length=*6* > >> > >> console.log('entered length=' + text.length); > >> > >> //shows compare length=*4* > >> > >> console.log('compare length=' + 'exit'.length); > >> > >> if (text == 'exit'){ > >> //never works > >> console.log('matched!'); > >> } > >> }); > >> > >> -- > >> Job Board: http://jobs.nodejs.org/ > >> Posting guidelines: > >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > >> You received this message because you are subscribed to the Google > >> Groups "nodejs" group. > >> To post to this group, send email to nodejs@googlegroups.com > >> To unsubscribe from this group, send email to > >> nodejs+unsubscr...@googlegroups.com > >> For more options, visit this group at > >> http://groups.google.com/group/nodejs?hl=en?hl=en > > > > > > -- > > Job Board: http://jobs.nodejs.org/ > > Posting guidelines: > > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > > You received this message because you are subscribed to the Google > > Groups "nodejs" group. > > To post to this group, send email to nodejs@googlegroups.com > > To unsubscribe from this group, send email to > > nodejs+unsubscr...@googlegroups.com > > For more options, visit this group at > > http://groups.google.com/group/nodejs?hl=en?hl=en > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] string encoding
Oh.. things are more simple than I supposed! Thank's, Dan! You saved my brain четверг, 2 августа 2012 г., 17:24:57 UTC+4 пользователь Dan Milon написал: > > for me, text is "exit\n" > I guess you are on windows, so text is "exit\r\n" > > The readline module might help you. > > On 08/02/2012 04:15 PM, Danil Gazizov wrote: > > I'm confused of how to compare string const with variable. > > Look at this simple example where keyboard input compares with const > > string. > > I suggest this is encoding problem. Please, tell me what should be > > done to exit process ? > > File encoding is utf8 > > > > process.stdin.setEncoding();//default is utf-8 > > process.stdin.resume(); > > process.stdin.on("data", function(text) { > > > > //shows entered length=*6* > > console.log('entered length=' + text.length); > > > > //shows compare length=*4* > > console.log('compare length=' + 'exit'.length); > > > > if (text == 'exit'){ > > //never works > > console.log('matched!'); > > } > > }); > > > > -- > > Job Board: http://jobs.nodejs.org/ > > Posting guidelines: > > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > > You received this message because you are subscribed to the Google > > Groups "nodejs" group. > > To post to this group, send email to nodejs@googlegroups.com > > To unsubscribe from this group, send email to > > nodejs+unsubscr...@googlegroups.com > > For more options, visit this group at > > http://groups.google.com/group/nodejs?hl=en?hl=en > > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] string encoding
try removing whitespace from the ends text = text.trim() On Thu, Aug 2, 2012 at 3:24 PM, Dan Milon wrote: > for me, text is "exit\n" > I guess you are on windows, so text is "exit\r\n" > > The readline module might help you. > > > On 08/02/2012 04:15 PM, Danil Gazizov wrote: >> >> I'm confused of how to compare string const with variable. >> Look at this simple example where keyboard input compares with const >> string. >> I suggest this is encoding problem. Please, tell me what should be done to >> exit process ? >> File encoding is utf8 >> >> process.stdin.setEncoding();//default is utf-8 >> process.stdin.resume(); >> process.stdin.on("data", function(text) { >> >> //shows entered length=*6* >> >> console.log('entered length=' + text.length); >> >> //shows compare length=*4* >> >> console.log('compare length=' + 'exit'.length); >> >> if (text == 'exit'){ >> //never works >> console.log('matched!'); >> } >> }); >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to nodejs@googlegroups.com >> To unsubscribe from this group, send email to >> nodejs+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en > > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] https, GoDaddy SSL cert, node.js under Microsoft Azure
On Thu, Aug 2, 2012 at 5:27 PM, thstart wrote: > Install GoDaddy SSL certificate with Node.js > > I want to use https for my web app which is running on Microsoft > Azure. > > I used IIS to generate certificate for GoDaddy then downloaded two files: > .crt > gd_iis_intermediates.p7b > Then I followed procedures described in GoDaddy to export and password > protect my .pfx certificate. Uploaded to MS Azure now my site > is serving https only. > > Now I need to use https.createServer(options, [requestListener]) as > described in: > http://nodejs.org/api/https.html > > // curl -k https://localhost:8000/ > var https = require('https'); > var fs = require('fs'); > > var options = { > key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), > cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem') > }; > > https.createServer(options, function (req, res) { > res.writeHead(200); > res.end("hello world\n"); > }).listen(8000); > > > > There is not a key when I am using IIS so I have to extract > it from the .pfx and remove the password or to use the .pfx > directly (which needs a password). How is the right way to > handle this? > > > var https = require('https'); > var fs = require('fs'); > > var options = { > pfx: fs.readFileSync('server.pfx') > }; > > https.createServer(options, function (req, res) { > res.writeHead(200); > res.end("hello world\n"); > }).listen(8000); You probably need to pass in a pass phrase. Have a look at the test case: https://github.com/joyent/node/blob/50e00de/test/simple/test-https-pfx.js -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] https, GoDaddy SSL cert, node.js under Microsoft Azure
Install GoDaddy SSL certificate with Node.js I want to use https for my web app which is running on Microsoft Azure. I used IIS to generate certificate for GoDaddy then downloaded two files: .crt gd_iis_intermediates.p7b Then I followed procedures described in GoDaddy to export and password protect my .pfx certificate. Uploaded to MS Azure now my site is serving https only. Now I need to use https.createServer(options, [requestListener]) as described in: http://nodejs.org/api/https.html // curl -k https://localhost:8000/var https = require('https');var fs = require('fs'); var options = { key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')}; https.createServer(options, function (req, res) { res.writeHead(200); res.end("hello world\n");}).listen(8000); There is not a key when I am using IIS so I have to extract it from the .pfx and remove the password or to use the .pfx directly (which needs a password). How is the right way to handle this? var https = require('https');var fs = require('fs'); var options = { pfx: fs.readFileSync('server.pfx')}; https.createServer(options, function (req, res) { res.writeHead(200); res.end("hello world\n");}).listen(8000); -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Problem with getting uv_tcp_t handle from net.Socket
On Aug 2, 9:45 am, mscdex wrote: > Code and errors:https://gist.github.com/0b29ddfcc440450b6dc6 > > Any help is greatly appreciated. Scratch that, TCPWrap isn't exported. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] string encoding
try removing whitespace from the ends text = text.trim() On Thu, Aug 2, 2012 at 3:24 PM, Dan Milon wrote: > for me, text is "exit\n" > I guess you are on windows, so text is "exit\r\n" > > The readline module might help you. > > > On 08/02/2012 04:15 PM, Danil Gazizov wrote: >> >> I'm confused of how to compare string const with variable. >> Look at this simple example where keyboard input compares with const >> string. >> I suggest this is encoding problem. Please, tell me what should be done to >> exit process ? >> File encoding is utf8 >> >> process.stdin.setEncoding();//default is utf-8 >> process.stdin.resume(); >> process.stdin.on("data", function(text) { >> >> //shows entered length=*6* >> >> console.log('entered length=' + text.length); >> >> //shows compare length=*4* >> >> console.log('compare length=' + 'exit'.length); >> >> if (text == 'exit'){ >> //never works >> console.log('matched!'); >> } >> }); >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to nodejs@googlegroups.com >> To unsubscribe from this group, send email to >> nodejs+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en > > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Problem with getting uv_tcp_t handle from net.Socket
Code and errors: https://gist.github.com/0b29ddfcc440450b6dc6 Any help is greatly appreciated. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] string encoding
for me, text is "exit\n" I guess you are on windows, so text is "exit\r\n" The readline module might help you. On 08/02/2012 04:15 PM, Danil Gazizov wrote: I'm confused of how to compare string const with variable. Look at this simple example where keyboard input compares with const string. I suggest this is encoding problem. Please, tell me what should be done to exit process ? File encoding is utf8 process.stdin.setEncoding();//default is utf-8 process.stdin.resume(); process.stdin.on("data", function(text) { //shows entered length=*6* console.log('entered length=' + text.length); //shows compare length=*4* console.log('compare length=' + 'exit'.length); if (text == 'exit'){ //never works console.log('matched!'); } }); -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: string encoding
On Aug 2, 9:15 am, Danil Gazizov wrote: > I'm confused of how to compare string const with variable. > Look at this simple example where keyboard input compares with const string. > I suggest this is encoding problem. Please, tell me what should be done to > exit process ? What is the output of `console.dir(text);` ? -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] string encoding
I'm confused of how to compare string const with variable. Look at this simple example where keyboard input compares with const string. I suggest this is encoding problem. Please, tell me what should be done to exit process ? File encoding is utf8 process.stdin.setEncoding();//default is utf-8 process.stdin.resume(); process.stdin.on("data", function(text) { //shows entered length=*6* console.log('entered length=' + text.length); //shows compare length=*4* console.log('compare length=' + 'exit'.length); if (text == 'exit'){ //never works console.log('matched!'); } }); -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Trying to understand streams and child processes
But thanks for all of your input on this one guys/gals On Monday, 30 July 2012 12:01:43 UTC+1, carlton wrote: > > Hi there, > > I am trying to implent a nodejs script that connects to one of our servers > using sftp. > > So far I can connect using child process and spawning a command such as... > > sftp -o Port=22-o PasswordAuthentication=no-o > UserKnownHostsFile=/home/carlton/.ssh/known_hosts-o > IdentityFile=private_key-o StrictHostKeyChecking=no-o > BatchMode=nodeploy@46.x.x.x:/home/carlton/to_process > > Now this is the part that has me confused... > > I then need to execute commands on the ftp server (e.g. list files, rename > files) so I listen to the 'data' event > > sftp.stdout.on('data', function (data) { > console.log('stdout: ' + data); > > sftp.stdin.write("ls -l\r\n"); > > sftp.stdout.on('data', function(data){ > console.log('File list:', data.toString()); > > // Parse file names here > > sftp.stdin.write("rename > /home/carlton/FTP_test/to_process/old.php /home/ carlton > /FTP_test/processed/new.php\n"); > }); > }); > > Is this the correct way to structure things (i.e. creatiung event listener > again for the 'data' event within the callback of the previous 'data' event > listener)? > I found it hard to find any examples similar to what I need to do which > made me think I haven't built this as it should have been. > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Trying to understand streams and child processes
I've gone back to using node-sftp, it seems like somebody made an addition that uses pty instead of tty I've explained what I did here, for me I couldn't use the version that came from "npm install", I had to download the version from git and copy the module to my project manually https://github.com/ajaxorg/node-sftp/issues/1 For me it's working really well and thankfully I'm making some decent progress. On Monday, 30 July 2012 12:01:43 UTC+1, carlton wrote: > > Hi there, > > I am trying to implent a nodejs script that connects to one of our servers > using sftp. > > So far I can connect using child process and spawning a command such as... > > sftp -o Port=22-o PasswordAuthentication=no-o > UserKnownHostsFile=/home/carlton/.ssh/known_hosts-o > IdentityFile=private_key-o StrictHostKeyChecking=no-o > BatchMode=nodeploy@46.x.x.x:/home/carlton/to_process > > Now this is the part that has me confused... > > I then need to execute commands on the ftp server (e.g. list files, rename > files) so I listen to the 'data' event > > sftp.stdout.on('data', function (data) { > console.log('stdout: ' + data); > > sftp.stdin.write("ls -l\r\n"); > > sftp.stdout.on('data', function(data){ > console.log('File list:', data.toString()); > > // Parse file names here > > sftp.stdin.write("rename > /home/carlton/FTP_test/to_process/old.php /home/ carlton > /FTP_test/processed/new.php\n"); > }); > }); > > Is this the correct way to structure things (i.e. creatiung event listener > again for the 'data' event within the callback of the previous 'data' event > listener)? > I found it hard to find any examples similar to what I need to do which > made me think I haven't built this as it should have been. > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: [RFC] Sandbox Module.
Bradley, what's the status of this? I was looking at extending the Sandbox framework a little by providing a dumbed down require() and wrappers for things like fs that enforce restrictions on paths etc. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Re: e-Commerce platform
When you want something to know about SEO I think it is the best to open a new thread. There are several ways: - Dual Templating (serve the side in two versions static and dynamic, use the same templating engine for both sides. Described by google) - Use pjax https://github.com/defunkt/jquery-pjax/tree/heroku Am Mittwoch, 1. August 2012 09:23:41 UTC+2 schrieb daslicht: > > Hello Friends, > > brainstorming > { > I am also going to create a CMS/eCommerce Solution for a Music Label. > > Since we want to offer seamless playback even while navigating the whole > page, we like to craete a single page AJAX interface. > > As far as I know we have to follwing options: > Create normal HTML page and hijack links with js and replace content if > js is enabled > serve alternative content (as it is described in the google guide for > crawlable ajax pages) > do I miss a solution? > > I would love to use something like Backbone Ember or Angular but in that > case It might me tedios to serve alternative content. > > How would you make such kind of page indexable by search engines? > How would you approcah this task ? > Any suggestions are welcome ! > } > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Trying to understand streams and child processes
On Jul 30, 11:20 am, carlton wrote: > I may also give this a chance https://github.com/sergi/jsftpas I tried it > a while ago only to get error "FTP is not defined" which was odd as the > module seems to be required without an error jsftp is plain FTP module, not SFTP. On Aug 1, 8:37 pm, rhasson wrote: > In all honesty this is a hacky way of building an FTP service. Ideally > you'd build a TCP server and properly handle FTP commands but with a > cleaner interface for your application. If you use this .spawn way you > need to manage state (which commands were issued, did they complete > successfully or failed, what data was sent, etc.) and passing the complete > data back to the application. SFTP is a totally different beast (it uses SSH) than just plain FTP, so there's a lot more work involved if you plan to go the non-child process route. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: How to fork child in "non persistent" way?
@Bert What I want to achieve is to be able to setup communication bridge with other process, but without blocking exit of main process. Following code will keep process running forever: var child = require('child_process').fork('./child.js'); child.on('message', function () { // Process message' }); child.unref(); It would be good to have some option to make it work similar way to the way watchers work with 'persistent' option set to false. Following code will exit immediately, even though we've initialized watcher, attached listener to it and didn't remove it: var watch = require('fs').watch(__dirname, { persistent: false }, function (event) { // Process event }); I wonder if similar setup would be possible with process communication. -- Mariusz Nowak http://github.com/medikoo http://twitter.com/medikoo On Thursday, August 2, 2012 12:59:54 AM UTC+2, Bert Belder wrote: > > On Friday, July 27, 2012 6:00:19 PM UTC+2, Mariusz Nowak wrote: >> >> I'd like to create fork (via child_process.fork) and make both master and >> child exit after all tasks in master process are done > > > If you're using node 0.8, you can do this: > > var cp = fork("foo.js") > cp.unref(); > > This will effectively "kill" the child process when the master exits, so > you may want to install a SIGHUP handler in your child process. > > - Bert > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en