Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (50 sloc) 2.25 KB
description
Datagram has a built-in CLI tool so you don't need to know how to write code to use it.

Command line

Use without installation

Thanks to NPM's npx utility, you can use Datagram without installing it locally. All you need is a relatively new version of NodeJS and NPM.

Creating, adding and sharing

# Generate Datagram user file
$ npx datagram user foo

# Create new datagram
$ npx datagram create -u foo my_datagram

Adding files and listing the contents

# Add a file
$ npx datagram add -u foo -d my_datagram cat.jpg

# Check that file is there
$ npx datagram list -u foo -d my_datagram

Sharing your datagram

One of the most useful things in Datagram is that you can share your datagram whenever you want with one click. When you share your datagram, you get a sharelink. Only the people who you give this sharelink can access your datagram.

# Share your datagram
$ npx datagram share -u foo -d my_datagram
# in return you get a sharelink

{% hint style="info" %} Keep in mind that Datagram is a peer-to-peer data transfer platform.
This means that when you share data, you are responsible to keep it available. It doesn't get uploaded to any 3rd party server. You are your own server. As long as you have dg sharerunning, you are sharing your data. {% endhint %}

Hosting your datagram

If you have a server, you can create hosting datagrams. Hosts will make a copy of your datagram and keep your datagram available when you are not online.

There are no limits on how many hosts you create. The more hosts you have running on different servers, the faster the download speeds and the more robust your datagram is against servers going down.

# Clone and host
$ npx datagram host -u foo -l [sharelink]

Use with local installation

Install from NPM

$ npm install -g datagram

Using dg utility command

Datagram has a built-in CLI utility called dg. The usage is exactly the same as shown above with npx. Replace npx datagram with dg and you are good to go.

{% hint style="info" %} If your system can't find dg utility, it's likely that npm failed to make the right links. In that case run npm link datagram. {% endhint %}

You can’t perform that action at this time.