Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var fs = require("fs");
- var test = function(cb) {
- var Copiers = {'follow': ['2215546130', '2785638816']};
- fs.exists ("BBDD.txt", function(exists){
- if (exists){
- fs.readFile("BBDD.txt", 'utf8', function(err, data){
- if (err){
- cb(err, null);
- } else {
- var json = JSON.parse(data);
- console.log(Copiers);
- var x = json.length;
- for (i=0; i<x; i++){
- Copiers.follow.push(json[i].id);
- }
- cb(null, Copiers);
- }
- })
- } else{
- cb("No existe el fichero", null);
- }
- });
- test(function (err, res) {
- if (err) {
- console.log("Error!");
- console.error(err);
- } else {
- console.log(require('util').inspect(res));
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement