pathchain 1.0.42 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/getter.js +12 -12
- package/package.json +1 -1
package/getter.js
CHANGED
|
@@ -288,7 +288,7 @@ function getPathlinkObj(xpathlink, xauthor) {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
// DECODING
|
|
291
|
+
// DECODING PATHLINK
|
|
292
292
|
var pathlink_enc = fileContents
|
|
293
293
|
var pathlink_obj = pathlink_pb.pathlink.decode(pathlink_enc)
|
|
294
294
|
|
|
@@ -324,7 +324,7 @@ function getTreeObj(xtree, xauthor) {
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
// DECODING
|
|
327
|
+
// DECODING TREE
|
|
328
328
|
var tree_enc = fileContents
|
|
329
329
|
var tree_obj = tree_pb.tree.decode(tree_enc)
|
|
330
330
|
|
|
@@ -333,25 +333,25 @@ function getTreeObj(xtree, xauthor) {
|
|
|
333
333
|
|
|
334
334
|
|
|
335
335
|
/** getTreelinkObj
|
|
336
|
-
* [Function that recieves a
|
|
336
|
+
* [Function that recieves a treelink hash and returns the treelink object]
|
|
337
337
|
*
|
|
338
|
-
* @param {string}
|
|
338
|
+
* @param {string} xtreelink (required)
|
|
339
339
|
*
|
|
340
340
|
* @return void
|
|
341
341
|
*/
|
|
342
|
-
function getTreelinkObj(
|
|
342
|
+
function getTreelinkObj(xtreelink, xauthor) {
|
|
343
343
|
|
|
344
344
|
if(xauthor != ""){
|
|
345
345
|
xauthor = xauthor + '/';
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
// LOADING PB
|
|
349
|
-
var
|
|
349
|
+
var treelink_pb = pb(fs.readFileSync('node_modules/pathchain/proto/treelink.proto'))
|
|
350
350
|
|
|
351
351
|
// NOT FOUND EXCEPTION
|
|
352
352
|
var fileContents;
|
|
353
353
|
try {
|
|
354
|
-
fileContents = fs.readFileSync("files/" + xauthor + "
|
|
354
|
+
fileContents = fs.readFileSync("files/" + xauthor + "treelinks/" + xtreelink);
|
|
355
355
|
} catch (err) {
|
|
356
356
|
if (err.code === 'ENOENT') {
|
|
357
357
|
return "Treelink not found";
|
|
@@ -360,11 +360,11 @@ function getTreelinkObj(xnodelink, xauthor) {
|
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
// DECODING
|
|
364
|
-
var
|
|
365
|
-
var
|
|
363
|
+
// DECODING TREELINK
|
|
364
|
+
var treelink_enc = fileContents
|
|
365
|
+
var treelink_obj = treelink_pb.treelink.decode(treelink_enc)
|
|
366
366
|
|
|
367
|
-
return
|
|
367
|
+
return treelink_obj;
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
|
|
@@ -396,7 +396,7 @@ function getLabelObj(xlabel, xauthor) {
|
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
// DECODING
|
|
399
|
+
// DECODING LABEL
|
|
400
400
|
var label_enc = fileContents
|
|
401
401
|
var label_obj = label_pb.label.decode(label_enc)
|
|
402
402
|
|