Storacle - penyimpanan file terdesentralisasi

gambar


Sebelum saya mulai, saya harus meninggalkan tautan ke artikel sebelumnya , sehingga jelas apa yang dimaksud.


Pada artikel ini, saya ingin mem-parsing layer yang bertanggung jawab untuk menyimpan file, dan bagaimana itu dapat digunakan oleh siapa saja. Storacle adalah perpustakaan independen , tidak ada koneksi langsung dengan musik. Anda dapat mengatur penyimpanan file apa pun.


Pada artikel sebelumnya, saya memutar laras sedikit pada ipfs , tetapi ini terjadi justru dalam konteks masalah yang saya pecahkan . Secara umum, saya pikir proyek ini keren. Saya hanya suka kesempatan untuk membuat jaringan yang berbeda untuk tugas yang berbeda. Ini memungkinkan Anda untuk mengatur struktur dengan lebih baik dan mengurangi beban pada masing-masing node dan jaringan secara keseluruhan. Dimungkinkan bahkan dalam kerangka satu proyek, jika perlu, untuk memecah jaringan menjadi beberapa bagian sesuai dengan beberapa kriteria, mengurangi beban keseluruhan.


, 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