This file contains 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 client = require('cheerio-httpcli'); | |
var request = require('request'); | |
var fs = require('fs'); | |
var URL = require('url'); | |
var Dir = "./files/img"; | |
if (!fs.existsSync(Dir)) { | |
fs.mkdirSync(Dir); | |
} |
This file contains 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 data = { | |
hoge: 100, | |
foo: 'a', | |
bar: true, | |
}; | |
fs.writeFile('./files/test.json', JSON.stringify(data, null, ' '), function (err) { | |
if (err) throw err; |
This file contains 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 client = require('cheerio-httpcli'); | |
var request = require('request'); | |
var fs = require('fs'); | |
var URL = require('url'); | |
var Dir = "./files/img"; | |
if (!fs.existsSync(Dir)) { | |
fs.mkdirSync(Dir); | |
} |
This file contains 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 url = "http://www.kaasan.info/";//ダウンロードURL | |
var savepath = "./test.html"; | |
var http = require('http'); //モジュール | |
var fs = require('fs'); //モジュール | |
var outfile = fs.createWriteStream(savepath); | |
http.get(url, function(res) { | |
res.pipe(outfile); | |
res.on('end', function () { |
This file contains 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
{ | |
"name": "vagrant", | |
"version": "1.0.0", | |
"description": "", | |
"main": "download-node-func.js", | |
"dependencies": {}, | |
"devDependencies": {}, | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, |
This file contains 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
config.vm.box = "CentOS7.0" | |
config.vm.network "forwarded_port", guest: 80, host: 8080 | |
config.vm.network "private_network", ip: "192.168.33.11" | |
config.vm.synced_folder "./app/", "/vagrant" |