Socket
Socket
Sign inDemoInstall

alexandria-core

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alexandria-core - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

82

index.js
import axios from 'axios';
import IPFS_MAIN from 'ipfs'
const ipfs = new IPFS_MAIN()
try {
var IPFS_MAIN = require('ipfs');
} catch (e) {
console.log(e);
}
let AlexandriaCore = (function(){

@@ -9,7 +13,12 @@ let Core = {};

// Initiate all instances
Core.ipfs = new IPFS_MAIN();
try {
Core.ipfs = new IPFS_MAIN();
} catch (e) {
Core.ipfs = "not-supported"
}
// Define all of the application URLS
Core.OIPdURL = "https://api.alexandria.io/alexandria/v2";
Core.IPFSGatewayURL = "https://gateway.ipfs.io/ipfs/";
Core.IPFSGatewayURL = "http://gateway.ipfs.io/ipfs/";

@@ -119,2 +128,6 @@ // Define URLS for things we don't control, these likely will change often

if (!type){
type = Core.Artifact.getType(oip);
}
for (let i = 0; i < files.length; i++){

@@ -126,3 +139,9 @@ if (files[i].type === type && !mainFile){

return mainFile;
let fileURL = "";
if (mainFile){
fileURL = location + "/" + mainFile.fname;
}
return fileURL;
}

@@ -392,26 +411,30 @@

Core.ipfs.files.cat(hash, function (err, file) {
if (err){
console.log(err);
return;
}
onData(Core.util.buildIPFSURL(hash));
let stream = file;
let chunks = [];
if (stream){
stream.on('data', function(chunk) {
chunks.push(chunk);
try {
Core.ipfs.files.cat(hash, function (err, file) {
if (err){
console.log(err);
return;
}
// Note, this might cause tons of lag depending on how many ongoing IPFS requests we have.
Core.util.chunksToFileURL(chunks, function(data){
onData(data);
let stream = file;
let chunks = [];
if (stream){
stream.on('data', function(chunk) {
chunks.push(chunk);
// Note, this might cause tons of lag depending on how many ongoing IPFS requests we have.
Core.util.chunksToFileURL(chunks, function(data){
onData(data);
})
});
stream.on('end', function(){
// Core.util.chunksToFileURL(chunks, function(data){
// onData(data);
// })
})
});
stream.on('end', function(){
// Core.util.chunksToFileURL(chunks, function(data){
// onData(data);
// })
})
}
})
}
})
} catch (e){ }
}

@@ -464,3 +487,8 @@

if (!fname){
trailURL = hash;
let parts = hash.split('/');
if (parts.length == 2){
trailURL = parts[0] + "/" + encodeURIComponent(parts[1]);
} else {
trailURL = hash;
}
} else {

@@ -467,0 +495,0 @@ trailURL = hash + "/" + encodeURIComponent(fname);

{
"name": "alexandria-core",
"version": "1.0.1",
"version": "1.0.2",
"description": "The core module of Alexandria!",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc