This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http'); | |
| var fs = require('fs'); | |
| var options = { | |
| host: 'nodejs.org', | |
| port: 80, | |
| path: '/docs/v0.3.6/api/http.html#http.ClientResponse' | |
| }; | |
| var ws=fs.createWriteStream('./file'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var sys = require('sys'), | |
| fs = require('fs'); | |
| var b=new Buffer('hello world'); | |
| fs.open('test','w',undefined, function(err,fd){ | |
| if(err) throw err; | |
| fs.write(fd,b,0,b.length,3,function(err,written){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define _XOPEN_SOURCE 500 | |
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| #include <fcntl.h> | |
| #include <unistd.h> | |
| int main(){ | |
| char* ds=new char[10]; | |
| for(unsigned int i = 0 ; i<10;i++) | |
| ds[i]=65; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs'); | |
| var http = require('http'); | |
| var urlparser = require('url'); | |
| var k = process.binding('constants'); | |
| function Download(url,path){ | |
| this.u= urlparser.parse(url); | |
| this.httpStatus=null; | |
| this.recievedHeader=null; | |
| this.filestats = {filesize: null, bytesWritten: 0, bytesRecieved: 0} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs'); | |
| var http = require('http'); | |
| var urlparser = require('url'); | |
| var k = process.binding('constants'); | |
| function Download(url,path, options,callback){ | |
| /* | |
| existing options: | |
| - range: [start, end] specifies the Range of the part to be downloaded. start or end may be null to specify download "from beginning" or "to end" respecively. | |
| - continue: if not set to true file will be truncated before writing to it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http'); | |
| var fs = require('fs'); | |
| var url = require('url'); | |
| var settingsPath='settings2.json'; | |
| var Server = function(path){ | |
| this.readSettings(path); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| proxy.balance = "fair" | |
| $HTTP["host"] == "localhost" { | |
| proxy.server = ("" => ( | |
| ("host" => "127.0.0.1", "port" => 8080) | |
| )) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* John Resig's array.remove taken from http://ejohn.org/blog/javascript-array-remove/ */ | |
| Array.prototype.remove = function(from, to) { | |
| var rest = this.slice((to || from) + 1 || this.length); | |
| this.length = from < 0 ? this.length + from : from; | |
| return this.push.apply(this, rest); | |
| }; | |
| var ticket = function(id){this.id=id} | |
| var ticketlist = function(){ this.q = [] , this.all= {}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var foo = exports; | |
| //now i would like to have a constructor function for the foo "class" (i know in JS that does not exist) | |
| //with normal js this would be | |
| foo = function(arg1,arg2){ | |
| this.something = arg1; | |
| this.somethingOther = arg2; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| locale: Cannot set LC_CTYPE to default locale: No such file or directory | |
| locale: Cannot set LC_MESSAGES to default locale: No such file or directory | |
| locale: Cannot set LC_COLLATE to default locale: No such file or directory | |
| C | |
| POSIX |
OlderNewer