-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3cd4c5a
commit 425dec0
Showing
11 changed files
with
246 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
// Uploads a DApp from a local directory to the Swarm network. | ||
// Outputs the DApp address. In this case, it is: | ||
// 8587c8e716bfceea12a7306d85a8a8ccad5019020916eb5a21fa47a7f1826891 | ||
// 379d2791624c3e3719bb28f7bfa362cc9c726ec06482b5800c8e3cefaf2b7bcf | ||
|
||
const swarm = require("./../swarm.js").at("http://swarm-gateways.net"); | ||
const path = require("path"); | ||
|
||
// Notice we use the `WithDefaultPath` version, which allows us to specify a | ||
// root file that will be served on the empty path (e.g., bzz:/my_dapp.eth/). | ||
swarm.uploadDirectoryFromDiskWithDefaultPath("/index.html")(path.join(__dirname,"example_dapp")) | ||
swarm.uploadDirectoryFromDisk("/index.html", path.join(__dirname,"example_dapp")) | ||
.then(console.log) | ||
.catch(console.log); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
// Downloads raw data from the Swarm network. | ||
// Outputs the downloaded data: "test string" | ||
// Outputs the downloaded data: "test" | ||
|
||
const swarm = require("./../swarm.js").at("http://swarm-gateways.net"); | ||
const hash = "a5c10851ef054c268a2438f10a21f6efe3dc3dcdcc2ea0e6a1a7a38bf8c91e23"; | ||
const hash = "c9a99c7d326dcc6316f32fe2625b311f6dc49a175e6877681ded93137d3569e7"; | ||
|
||
swarm.downloadData(hash) | ||
swarm.download(hash) | ||
.then(buffer => console.log(buffer.toString())) | ||
.catch(console.log); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
// Uploads raw data to the Swarm network. | ||
// Outputs the Swarm address: a5c10851ef054c268a2438f10a21f6efe3dc3dcdcc2ea0e6a1a7a38bf8c91e23 | ||
// Outputs the Swarm address: c9a99c7d326dcc6316f32fe2625b311f6dc49a175e6877681ded93137d3569e7 | ||
|
||
const swarm = require("./../swarm.js").at("http://swarm-gateways.net"); | ||
|
||
swarm.uploadData("test string") | ||
swarm.upload(new Buffer("test")) | ||
.then(console.log) | ||
.catch(console.log); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
{ | ||
"name": "swarm-js", | ||
"version": "0.1.0", | ||
"version": "0.1.3", | ||
"description": "Swarm tools for JavaScript.", | ||
"main": "swarm.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "MaiaVictor", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"dependencies": { | ||
"bluebird": "^3.4.7", | ||
"fs-promise": "^2.0.0", | ||
"got": "^6.7.1", | ||
"mimetype": "0.0.8", | ||
"mkdirp-promise": "^5.0.1", | ||
"tar.gz": "^1.0.5" | ||
} | ||
} |
Oops, something went wrong.