libraryd-data
was created to allow users to easily access artifacts and hashes without having to call the LibraryD API endpoint. It exposes functions that allow quick; fast; and easy storage/recall of all OIP/Alexandria artifacts. It will store any new hashes that it requests from LibraryD to speed up future recalls of data.
Install using NPM
$ npm install libraryd-data
var LDD = require("libraryd-data");
LDD.getArtifact("artifactTXID");
LDD.search("searchTerm");
LDD.changeDataSource("127.0.0.1", false);
This method will return the artifact JSON using only the txid. If a callback function is not provided, then it will only search the local cache.
LDD.getArtifact('fb7560ad53d4299b55250583f2f5c7975cd6e0c3c5b587cb49d7eee1799b58cf', function(data){
console.log(JSON.stringify(data));
});
This method will return all matching artifacts that match the text provided. This will return up to 50 results.
LDD.search('test', function(data){
console.log(JSON.stringify(data));
});