Storacle - armazenamento de arquivos descentralizado

imagem


Antes de começar, devo deixar um link para o artigo anterior , para que fique claro o que exatamente se entende.


Neste artigo, eu gostaria de analisar a camada responsável pelo armazenamento de arquivos e como ela pode ser usada por qualquer pessoa. Storacle é uma biblioteca independente , não há conexão direta com a música. Você pode organizar o armazenamento de qualquer arquivo.


No artigo anterior, eu rolei o barril um pouco no ipfs , mas isso aconteceu precisamente no contexto do problema que estava resolvendo . Em geral, acho esse projeto legal. Eu apenas gosto da oportunidade de criar redes diferentes para tarefas diferentes. Isso permite que você organize melhor a estrutura e reduza a carga em nós individuais e na rede como um todo. É possível, mesmo dentro da estrutura de um projeto, se necessário, dividir a rede em pedaços de acordo com alguns critérios, reduzindo a carga geral.


, 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