How to getFile or putFile from blockstack CLI?

i installed the blockstack via pip and noticed that there are getFile and putFile functionality there as well as blockstack.js but i can’t find the required field t successfully get or put a file.

can you recommend a tutorial that use CLI to upload and download files or how I can find the datastore id and other parameters that are required by this command?


@mhadiemami our storage tutorial illustrates some examples of getFile() and putFile().

Our CLI is undergoing some revamping. @jude may have an some suggestions for what you ask.

thank you @moxiegirl for your reply. i already created an app that uses blockstack.js to put and get files but i need to do the same function from nodeJs server (without any browser).

This is not an officially support method as far as I know, but with the authResponseToken and identityAddress, here’s a code snippet that will work in Node:

var request = require("request");

var options = { method: 'POST',
  url: '' + identityAddress + filename,
 Authorization: 'bearer v1:' + authResponseToken,
 'Content-Type': 'application/octet-stream' },
  body: '{\n\t"title": "Test"\n}' 

request(options, function (error, response, body) {
if (error) throw new Error(error);

1 Like

You can do it with the CLI. Type blockstack-cli help gaia_getfile or blockstack-cli help gaia_putfile to see usage and examples.

1 Like