Comparing version 1.1.4 to 1.1.5
{ | ||
"name": "fsgod", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Secure file sharing, hosting, and transfer", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,5 +19,9 @@ | ||
fsgod.VDT('./', (vdt) => { | ||
for ( var i = 0; i < vdt.content.length; i++ ){ | ||
console.log(vdt.content[i].name); | ||
} | ||
vdt.content.forEach((item, index) => { | ||
if (item.type == 'directory') { | ||
console.log(item.name + ' is a dir with ' + item.content.length + ' items'); | ||
} else { | ||
console.log(item.name) | ||
} | ||
}); | ||
}); | ||
@@ -27,3 +31,3 @@ | ||
The above code should log the names of all the items in the directory it's currently in to the console | ||
The above code looks through the specified directory's virtual content and if it finds another directory, it prints it's name and items, if it's not a directory, it will just print it's name | ||
@@ -209,4 +213,3 @@ The **vdt** object that gets passed to the callback in **fsgod.VDT** is the Virtual Directory Tree. **fsgod.VDT** recursively walks all the way through the specified folder and builds each item into a JavaScript object and passes it back to the user in the callback. | ||
var file = vdt.get('test.json'); | ||
fileJSON = file.json(); | ||
console.log(fileJSON.foo); // will log 'bar' | ||
console.log(file.json().foo); // will log 'bar' | ||
}); | ||
@@ -225,7 +228,7 @@ }); | ||
if (err) throw err; | ||
var file = vdt.get('test.json'); | ||
fileJSON = file.json(); | ||
console.log(fileJSON.foo); // will log 'bar' | ||
fileJSON.foo = "updated!"; | ||
file.writejson(fileJSON, () => { | ||
var file = vdt.get('test.json'), | ||
json = file.json(); | ||
console.log(json.foo); // will log 'bar' | ||
json.foo = "updated!"; | ||
file.writejson(json, () => { | ||
console.log(file.json().foo); // wil log 'updated!' | ||
@@ -232,0 +235,0 @@ }); |
23024
265