Storacle - almacenamiento descentralizado de archivos

imagen


Antes de comenzar, debo dejar un enlace al artículo anterior , para que quede claro qué significa exactamente.


En este artĂ­culo, me gustarĂ­a analizar la capa responsable del almacenamiento de archivos y cĂłmo puede ser utilizada por cualquier persona. Storacle es una biblioteca independiente , no hay conexiĂłn directa con la mĂşsica. Puede organizar el almacenamiento de cualquier archivo.


En el artĂ­culo anterior, hice rodar el barril un poco en ipfs , pero esto sucediĂł precisamente en el contexto del problema que estaba resolviendo . En general, creo que este proyecto es genial. Simplemente me gusta la oportunidad de crear diferentes redes para diferentes tareas. Esto le permite organizar mejor la estructura y reducir la carga en los nodos individuales y la red en su conjunto. Es posible incluso dentro del marco de un proyecto, si es necesario, dividir la red en pedazos de acuerdo con algunos criterios, reduciendo la carga general.


, storacle spreadable . :


  • .
  • , .
  • .
  • ( , )
  • spreadable , ( )

, :


:


const  Node = require('storacle').Node;

(async () => {
  try {
    const node = new Node({
      port: 4000,
      hostname: 'localhost'
    });
    await node.init();
  }
  catch(err) {
    console.error(err.stack);
    process.exit(1);
  }
})();

:


const  Client = require('storacle').Client;

(async () => {
  try {
    const client = new  Client({
      address: 'localhost:4000'
    });
    await client.init();
    const hash = await client.storeFile('./my-file');
    const link = await client.getFileLink(hash); 
    await client.removeFile(hash);
  }
  catch(err) {
    console.error(err.stack);
    process.exit(1);
  }
})();


. , in-memory , . , - , . , (> ) . . "" , .


256 2 . . 1. 62500 (1000000 / sqrt(256)).


, , .


: , , , ... .



, , .
. . http .



javascript , . 
https://github.com/ortexx/storacle/blob/master/dist/storacle.client.js window.ClientStoracle ...



" ". , , , . , , , - . src . .


Api


  • async Client.prototype.storeFile() —
  • async Client.prototype.getFileLink() —
  • async Client.prototype.getFileLinks() — ,
  • async Client.prototype.getFileToBuffer() —
  • async Client.prototype.getFileToPath() —
  • async Client.prototype.getFileToBlob() — blob( )
  • async Client.prototype.removeFile() —
  • Client.prototype.createRequestedFileLink() —


, :


  • . ( )
  • . , , node.normalizeFilesInfo(), .
  • node.exportFiles(), .


, .
, .


  • storage.dataSize —
  • storage.tempSize —
  • storage.autoCleanSize — , . , .
  • file.maxSize —
  • file.minSize —
  • file.preferredDuplicates —
  • file.mimeWhitelist —
  • file.mimeBlacklist —
  • file.extWhitelist —
  • file.extBlacklist —
  • file.linkCache —

, .



. : npm i -g storacle. , . , storacle -a storeFile -f ./file.txt -c ./config.js, . https://github.com/ortexx/storacle/blob/master/bin/actions.js



  • - , . , , , storacle.
  • , . , , .
  • - . , .
  • , , . .

:



All Articles