NAME

Net::Ethereum::Swarm - Perl Framework for a distributed storage platform and content distribution service Ethereum Swarm.

SYNOPSIS

# Upload text file to Ethereum Swarm

use Net::Ethereum::Swarm; my $uploaded_file_path = $ARGV[0]; my $sw_node = Net::Ethereum::Swarm->new('http://localhost:8500/'); my $rc = $sw_node->_swarp_node_upload_text_file($uploaded_file_path, 'plain/text; charset=UTF-8'); print Dumper($rc), "\n";

# Upload binary file to Ethereum Swarm

use Net::Ethereum::Swarm; my $uploaded_file_path = $ARGV[0]; my $sw_node = Net::Ethereum::Swarm->new('http://localhost:8500/'); my $rc = $sw_node->_swarp_node_upload_binary_file($uploaded_file_path, 'image/jpeg'); print Dumper($rc), "\n";

# Get manifest by manifest id

use Net::Ethereum::Swarm; my $manifest_id = $ARGV[0]; my $sw_node = Net::Ethereum::Swarm->new('http://localhost:8500/'); my $rc = $sw_node->_swarp_node_get_manifest($manifest_id); print Dumper($rc), "\n";

# Get file from Ethereum Swarm

use Net::Ethereum::Swarm; my $manifest_id = $ARGV[0]; my $file_path_to_save = $ARGV[1]; my $sw_node = Net::Ethereum::Swarm->new('http://localhost:8500/'); my $rc = $sw_node->_swarp_node_get_file($manifest_id, $file_path_to_save, 'plain/text; charset=UTF-8'); print Dumper($rc), "\n";

DESCRIPTION

Net::Ethereum::Swarm - Perl Framework for a distributed storage platform and content distribution service Ethereum Swarm.

FUNCTIONS

new()

my $sw_node = Net::Ethereum::Swarm->new('http://localhost:8500/');

_swarp_node_get_manifest

Get manifest by manifest id
my $rc = $sw_node->_swarp_node_get_manifest($manifest_id);

_swarp_node_get_file

Get file from Ethereum Swarm
my $rc = $sw_node->_swarp_node_get_file($manifest_id, $file_path_to_save, 'plain/text; charset=UTF-8');

_swarp_node_upload_text_file

Upload text file to Ethereum Swarm

my $rc = $sw_node->_swarp_node_upload_text_file($uploaded_file_path, 'plain/text; charset=UTF-8');

_swarp_node_upload_binary_file

Upload binary file to Ethereum Swarm

my $rc = $sw_node->_swarp_node_upload_binary_file($uploaded_file_path, 'image/jpeg');

_swarp_node_request

Internal method.
Send request to Ethereum Swarm

my $ua_rc = $this->_swarp_node_request('POST', 'bzz:/', $header, $file_content);

set_debug_mode

Set dubug mode. Debug info printed to console.
$node->set_debug_mode($mode);

$mode: 1 - debug on, 0 - debug off.

SEE ALSO

  1. Swarm documentation: https://swarm-guide.readthedocs.io/en/latest/index.html

  2. GitHub Swarm guide: https://github.com/ethersphere/swarm-guide/blob/master/contents/usage.rst

  3. Swarm API improvements : https://gist.github.com/lmars/a37f3eaa129f95273c8c536e98920368

AUTHOR

Alexandre Frolov, frolov@itmatrix.ru

L<https://www.facebook.com/frolov.shop2you>
The founder and director of SAAS online store service Shop2YOU, L<http://www.shop2you.ru>

COPYRIGHT AND LICENSE

Copyright (C) 2018 by Alexandre Frolov

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.26.0 or,
at your option, any later version of Perl 5 you may have available.