Nodejs

 

 

 

cho2_test7.js

var os =require('os');

console.log('hostname : '  + os.hostname());
console.log('memory : ' + os.freemem());

 

Command: node "C:/Program Files (x86)/Brackets/www/macaronics/cho02_test7.js"

Working directory: C:/Program Files (x86)/Brackets/www/macaronics/

hostname : 8WWZYNOG30EGKNH

memory : 3553873920

Program exited with code 0

 

 

cho2_test8.js

var path =require('path');

var directories = ['Users', 'Mars', 'docs'];
var dirStr =directories.join();
console.log ('dir  : ' + dirStr);


var dirStr2 =directories.join(path.sep);
console.log('dir2 : ' + dirStr2);

var filePath =path.join('/Users/Mars', 'notepad.exe');
console.log('filePath  : ' + filePath);


var dirname=path.dirname(filePath);
console.log('dirname :  '+ dirname);


var basenme =path.basename(filePath);
console.log('basename : ' + basenme);
var extname=path.extname(filePath);
console.log('extname : ' + extname);






 

출력 = >

 

Command: node "C:/Program Files (x86)/Brackets/www/macaronics/ch02_test8.js"

Working directory: C:/Program Files (x86)/Brackets/www/macaronics/

dir : Users,Mars,docs

dir2 : Users\Mars\docs

filePath : \Users\Mars\notepad.exe

dirname : \Users\Mars

basename : notepad.exe

extname : .exe

Program exited with code 0

 

 

 

 

 

 

 

Node.js

 

about author

PHRASE

Level 60  라이트

여름 불도 쬐다 나면 섭섭하다 , 쓸데없는 것이라도 있던 것이 없어지면 섭섭하다.

댓글 ( 4)

댓글 남기기

작성

Nodejs 목록    more